diff --git a/CHANGELOG.md b/CHANGELOG.md index 4281e5148..ab38b667f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - PR #612 Drop old Python `device_array*` API - PR #603 Always test both legacy and per-thread default stream - PR #611 Add a note to the contribution guide about requiring 2 C++ reviewers +- PR #615 Improve gpuCI Scripts ## Bug Fixes diff --git a/ci/cpu/build.sh b/ci/cpu/build.sh index 4b745d87f..e672e2f53 100755 --- a/ci/cpu/build.sh +++ b/ci/cpu/build.sh @@ -5,14 +5,9 @@ ###################################### set -e -# Logger function for build status output -function logger() { - echo -e "\n>>>> $@\n" -} - # Set path and build parallel level -export PATH=/conda/bin:/usr/local/cuda/bin:$PATH -export PARALLEL_LEVEL=4 +export PATH=/opt/conda/bin:/usr/local/cuda/bin:$PATH +export PARALLEL_LEVEL=${PARALLEL_LEVEL:-4} # Set home to the job's workspace export HOME=$WORKSPACE @@ -20,6 +15,10 @@ export HOME=$WORKSPACE # Switch to project root; also root of repo checkout cd $WORKSPACE +# Setup 'gpuci_conda_retry' for build retries (results in 2 total attempts) +export GPUCI_CONDA_RETRY_MAX=1 +export GPUCI_CONDA_RETRY_SLEEP=30 + # If nightly build, append current YYMMDD to version if [[ "$BUILD_MODE" = "branch" && "$SOURCE_BRANCH" = branch-* ]] ; then export VERSION_SUFFIX=`date +%y%m%d` @@ -29,17 +28,22 @@ fi # SETUP - Check environment ################################################################################ -logger "Get env..." +gpuci_logger "Get env" env -logger "Activate conda env..." -source activate gdf +gpuci_logger "Activate conda env" +. /opt/conda/etc/profile.d/conda.sh +conda activate rapids -logger "Check versions..." +gpuci_logger "Check versions" python --version gcc --version g++ --version -conda list + +gpuci_logger "Check conda environment" +conda info +conda config --show-sources +conda list --show-channel-urls # FIX Added to deal with Anancoda SSL verification issues during conda builds conda config --set ssl_verify False @@ -47,26 +51,29 @@ conda config --set ssl_verify False ################################################################################ # BUILD - Conda package builds (conda deps: librmm <- rmm) ################################################################################ + if [[ "$BUILD_LIBRMM" == "1" ]]; then - logger "Build conda pkg for librmm..." - source ci/cpu/librmm/build_librmm.sh + gpuci_logger "Build conda pkg for librmm" + if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then + conda build conda/recipes/librmm --python=$PYTHON + else + conda build --dirty --no-remove-work-dir conda/recipes/librmm + fi fi if [[ "$BUILD_RMM" == "1" ]]; then - logger "Build conda pkg for rmm..." - source ci/cpu/rmm/build_rmm.sh + gpuci_logger "Build conda pkg for rmm" + if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then + conda build conda/recipes/rmm --python=$PYTHON + else + conda build --dirty --no-remove-work-dir conda/recipes/rmm + fi fi ################################################################################ # UPLOAD - Conda packages ################################################################################ -if [[ "$BUILD_LIBRMM" == "1" ]]; then - logger "Upload conda pkg for librmm..." - source ci/cpu/librmm/upload-anaconda.sh -fi +gpuci_logger "Upload conda packages" +source ci/cpu/upload.sh -if [[ "$BUILD_RMM" == "1" ]]; then - logger "Upload conda pkg for rmm..." - source ci/cpu/rmm/upload-anaconda.sh -fi diff --git a/ci/cpu/librmm/build_librmm.sh b/ci/cpu/librmm/build_librmm.sh deleted file mode 100755 index 4936d5597..000000000 --- a/ci/cpu/librmm/build_librmm.sh +++ /dev/null @@ -1,9 +0,0 @@ -set -e - -echo "Building librmm" -CUDA_REL=${CUDA_VERSION%.*} -if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then - conda build conda/recipes/librmm --python=$PYTHON -else - conda build --dirty --no-remove-work-dir conda/recipes/librmm -fi diff --git a/ci/cpu/librmm/upload-anaconda.sh b/ci/cpu/librmm/upload-anaconda.sh deleted file mode 100755 index 117029e3f..000000000 --- a/ci/cpu/librmm/upload-anaconda.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# Adopted from https://github.com/tmcdonell/travis-scripts/blob/dfaac280ac2082cd6bcaba3217428347899f2975/update-accelerate-buildbot.sh - -set -e - -if [ "$UPLOAD_LIBRMM" == '1' ]; then - export UPLOADFILE=$(conda build conda/recipes/librmm --python=$PYTHON --output) - - CUDA_REL=${CUDA_VERSION%.*} - - - LABEL_OPTION="--label main" - echo "LABEL_OPTION=${LABEL_OPTION}" - - # Restrict uploads to master branch - if [ ${BUILD_MODE} != "branch" ]; then - echo "Skipping upload" - return 0 - fi - - if [ -z "$MY_UPLOAD_KEY" ]; then - echo "No upload key" - return 0 - fi - - echo "Upload" - echo ${UPLOADFILE} - anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${UPLOADFILE} -fi - diff --git a/ci/cpu/rmm/build_rmm.sh b/ci/cpu/rmm/build_rmm.sh deleted file mode 100755 index ca3434292..000000000 --- a/ci/cpu/rmm/build_rmm.sh +++ /dev/null @@ -1,9 +0,0 @@ -set -e - -echo "Building rmm" -export RMM_BUILD_NO_GPU_TEST=1 -if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then - conda build conda/recipes/rmm --python=$PYTHON -else - conda build -c ci/artifacts/rmm/cpu/conda-bld/ --dirty --no-remove-work-dir --python=$PYTHON conda/recipes/rmm -fi diff --git a/ci/cpu/rmm/upload-anaconda.sh b/ci/cpu/rmm/upload-anaconda.sh deleted file mode 100755 index 696ad3588..000000000 --- a/ci/cpu/rmm/upload-anaconda.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Adopted from https://github.com/tmcdonell/travis-scripts/blob/dfaac280ac2082cd6bcaba3217428347899f2975/update-accelerate-buildbot.sh - -set -e - -if [ "$UPLOAD_RMM" == "1" ]; then - export UPLOADFILE=$(conda build conda/recipes/rmm --python=$PYTHON --output) - - - LABEL_OPTION="--label main" - echo "LABEL_OPTION=${LABEL_OPTION}" - - test -e ${UPLOADFILE} - - # Restrict uploads to master branch - if [ ${BUILD_MODE} != "branch" ]; then - echo "Skipping upload" - return 0 - fi - - if [ -z "$MY_UPLOAD_KEY" ]; then - echo "No upload key" - return 0 - fi - - echo "Upload" - echo ${UPLOADFILE} - anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${UPLOADFILE} -fi diff --git a/ci/cpu/upload.sh b/ci/cpu/upload.sh new file mode 100644 index 000000000..68bc847b3 --- /dev/null +++ b/ci/cpu/upload.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Adopted from https://github.com/tmcdonell/travis-scripts/blob/dfaac280ac2082cd6bcaba3217428347899f2975/update-accelerate-buildbot.sh + +set -e + +# Setup 'gpuci_retry' for upload retries (results in 4 total attempts) +export GPUCI_RETRY_MAX=3 +export GPUCI_RETRY_SLEEP=30 + +# Set default label options if they are not defined elsewhere +export LABEL_OPTION=${LABEL_OPTION:-"--label main"} + +# Skip uploads unless BUILD_MODE == "branch" +if [ ${BUILD_MODE} != "branch" ]; then + echo "Skipping upload" + return 0 +fi + +# Skip uploads if there is no upload key +if [ -z "$MY_UPLOAD_KEY" ]; then + echo "No upload key" + return 0 +fi + +################################################################################ +# SETUP - Get conda file output locations +################################################################################ + +gpuci_logger "Get conda file output locations" + +export LIBRMM_FILE=`conda build conda/recipes/librmm --output` +export RMM_FILE=`conda build conda/recipes/rmm --python=$PYTHON --output` + +################################################################################ +# UPLOAD - Conda packages +################################################################################ + +gpuci_logger "Starting conda uploads" + +if [ "$BUILD_LIBRMM" == "1" && "$UPLOAD_LIBRMM" == "1" ]; then + test -e ${LIBRMM_FILE} + echo "Upload librmm" + echo ${LIBRMM_FILE} + gpuci_retry anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${LIBRMM_FILE} +fi + +if [ "$BUILD_RMM" == "1" && "$UPLOAD_RMM" == "1" ]; then + test -e ${RMM_FILE} + echo "Upload rmm" + echo ${RMM_FILE} + gpuci_retry anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${RMM_FILE} +fi + diff --git a/ci/docs/build.sh b/ci/docs/build.sh index e0e558a4d..e88e460e1 100644 --- a/ci/docs/build.sh +++ b/ci/docs/build.sh @@ -18,26 +18,28 @@ export LIBCUDF_KERNEL_CACHE_PATH="$HOME/.jitify-cache" export NIGHTLY_VERSION=$(echo $BRANCH_VERSION | awk -F. '{print $2}') export PROJECTS=(rmm) -logger "Check environment..." +gpuci_logger "Check environment" env -logger "Check GPU usage..." +gpuci_logger "Check GPU usage" nvidia-smi -logger "Activate conda env..." -source activate rapids -# TODO: Move installs to docs-build-env meta package -conda install -c anaconda beautifulsoup4 jq +gpuci_logger "Activate conda env" +. /opt/conda/etc/profile.d/conda.sh +conda activate rapids - -logger "Check versions..." +gpuci_logger "Check versions" python --version $CC --version $CXX --version -conda list + +gpuci_logger "Check conda environment" +conda info +conda config --show-sources +conda list --show-channel-urls # Build Doxygen docs -logger "Build Doxygen docs..." +gpuci_logger "Build Doxygen docs" cd $PROJECT_WORKSPACE/doxygen doxygen Doxyfile diff --git a/ci/gpu/build.sh b/ci/gpu/build.sh index 7ef45f5ae..6ca583d48 100755 --- a/ci/gpu/build.sh +++ b/ci/gpu/build.sh @@ -7,19 +7,14 @@ set -e NUMARGS=$# ARGS=$* -# Logger function for build status output -function logger() { - echo -e "\n>>>> $@\n" -} - # Arg parsing function function hasArg { (( ${NUMARGS} != 0 )) && (echo " ${ARGS} " | grep -q " $1 ") } # Set path and build parallel level -export PATH=/conda/bin:/usr/local/cuda/bin:$PATH -export PARALLEL_LEVEL=4 +export PATH=/opt/conda/bin:/usr/local/cuda/bin:$PATH +export PARALLEL_LEVEL=${PARALLEL_LEVEL:-4} # Set home to the job's workspace export HOME=$WORKSPACE @@ -36,31 +31,36 @@ export MINOR_VERSION=`echo $GIT_DESCRIBE_TAG | grep -o -E '([0-9]+\.[0-9]+)'` # SETUP - Check environment ################################################################################ -logger "Get env..." +gpuci_logger "Get env" env -logger "Activate conda env..." -source activate gdf +gpuci_logger "Activate conda env" +. /opt/conda/etc/profile.d/conda.sh +conda activate rapids # Install build env -conda install rapids-build-env=${MINOR_VERSION}.* +gpuci_conda_retry install rapids-build-env=${MINOR_VERSION}.* # https://docs.rapids.ai/maintainers/depmgmt/ -# conda remove -f rapids-build-env -# conda install "your-pkg=1.0.0" +# gpuci_conda_retry remove -f rapids-build-env +# gpuci_conda_retry install "your-pkg=1.0.0" -logger "Check versions..." +gpuci_logger "Check versions" python --version -gcc --version -g++ --version -conda list +$CC --version +$CXX --version + +gpuci_logger "Check conda environment" +conda info +conda config --show-sources +conda list --show-channel-urls if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then ################################################################################ # BUILD - Build and install librmm and rmm ################################################################################ - logger "Build and install librmm and rmm..." + gpuci_logger "Build and install librmm and rmm" "$WORKSPACE/build.sh" -v clean librmm rmm ################################################################################ @@ -68,17 +68,17 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then ################################################################################ if hasArg --skip-tests; then - logger "Skipping Tests..." + gpuci_logger "Skipping Tests" else - logger "Check GPU usage..." + gpuci_logger "Check GPU usage" nvidia-smi - logger "Running googletests..." + gpuci_logger "Running googletests" cd "${WORKSPACE}/build" GTEST_OUTPUT="xml:${WORKSPACE}/test-results/" make -j${PARALLEL_LEVEL} test - logger "Python py.test for librmm_cffi..." + gpuci_logger "Python py.test for librmm_cffi" cd $WORKSPACE/python py.test --cache-clear --basetemp=${WORKSPACE}/rmm-cuda-tmp --junitxml=${WORKSPACE}/test-results/junit-rmm.xml -v --cov-config=.coveragerc --cov=rmm --cov-report=xml:${WORKSPACE}/python/rmm-coverage.xml --cov-report term fi @@ -89,10 +89,10 @@ else mkdir -p ${TESTRESULTS_DIR} SUITEERROR=0 - logger "Check GPU usage..." + gpuci_logger "Check GPU usage" nvidia-smi - logger "Running googletests..." + gpuci_logger "Running googletests" # run gtests cd $WORKSPACE/ci/artifacts/rmm/cpu/conda_work for gt in "build/gtests/*" ; do @@ -106,14 +106,14 @@ else cd $WORKSPACE/python - logger "Installing librmm..." + gpuci_logger "Installing librmm" conda install -c $WORKSPACE/ci/artifacts/rmm/cpu/conda-bld/ librmm export LIBRMM_BUILD_DIR="$WORKSPACE/ci/artifacts/rmm/cpu/conda_work/build" - logger "Building rmm" + gpuci_logger "Building rmm" "$WORKSPACE/build.sh" -v rmm - logger "pytest rmm" + gpuci_logger "pytest rmm" py.test --cache-clear --junitxml=${WORKSPACE}/test-results/junit-rmm.xml -v --cov-config=.coveragerc --cov=rmm --cov-report=xml:${WORKSPACE}/python/rmm-coverage.xml --cov-report term exitcode=$? if (( ${exitcode} != 0 )); then diff --git a/conda/recipes/librmm/build.sh b/conda/recipes/librmm/build.sh index 6cb01b79b..5de348a78 100644 --- a/conda/recipes/librmm/build.sh +++ b/conda/recipes/librmm/build.sh @@ -1,6 +1,4 @@ # Copyright (c) 2018-2019, NVIDIA CORPORATION. # This assumes the script is executed from the root of the repo directory -printenv -git clean -xdf ./build.sh -v clean librmm diff --git a/conda/recipes/rmm/build.sh b/conda/recipes/rmm/build.sh index ae31ffe5d..d2c672e69 100644 --- a/conda/recipes/rmm/build.sh +++ b/conda/recipes/rmm/build.sh @@ -1,8 +1,4 @@ # Copyright (c) 2018-2019, NVIDIA CORPORATION. # Script assumes the script is executed from the root of the repo directory -printenv -if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then - git clean -xdf -fi ./build.sh -v clean rmm