Skip to content

Commit

Permalink
Merge pull request #1396 from rapidsai/branch-0.18
Browse files Browse the repository at this point in the history
[gpuCI] Auto-merge branch-0.18 to branch-0.19 [skip ci]
  • Loading branch information
GPUtester authored Feb 10, 2021
2 parents 1021507 + 466e29a commit 3f1bd86
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 83 deletions.
46 changes: 0 additions & 46 deletions ci/getGTestTimes.sh

This file was deleted.

28 changes: 17 additions & 11 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
##########################################
# cuGraph GPU build & testscript for CI #
##########################################
set -e
set -o pipefail
set -e # abort the script on error, this will change for running tests (see below)
set -o pipefail # piped commands propagate their error
NUMARGS=$#
ARGS=$*

Expand Down Expand Up @@ -98,10 +98,15 @@ fi
# TEST - Run GoogleTest and py.tests for libcugraph and cuGraph
################################################################################

set +e -Eo pipefail
EXITCODE=0
# Switch to +e to allow failing commands to continue the script, which is needed
# so all testing commands run regardless of pass/fail. This requires the desired
# exit code to be managed using the ERR trap.
set +e # allow script to continue on error
set -E # ERR traps are inherited by subcommands
trap "EXITCODE=1" ERR

EXITCODE=0

if hasArg --skip-tests; then
gpuci_logger "Skipping Tests"
else
Expand All @@ -117,18 +122,19 @@ else
TEST_MODE_FLAG=""
fi

gpuci_logger "Running cuGraph test.sh..."
${WORKSPACE}/ci/test.sh ${TEST_MODE_FLAG} | tee testoutput.txt
gpuci_logger "Ran cuGraph test.sh : return code was: $?, gpu/build.sh exit code is now: $EXITCODE"

echo -e "\nTOP 20 SLOWEST TESTS:\n"
# Wrap in echo to prevent non-zero exit since this command is non-essential
echo "$(${WORKSPACE}/ci/getGTestTimes.sh testoutput.txt | head -20)"

gpuci_logger "Running cuGraph notebook test script..."
${WORKSPACE}/ci/gpu/test-notebooks.sh 2>&1 | tee nbtest.log
gpuci_logger "Ran cuGraph notebook test script : return code was: $?, gpu/build.sh exit code is now: $EXITCODE"
python ${WORKSPACE}/ci/utils/nbtestlog2junitxml.py nbtest.log
fi

if [ -n "\${CODECOV_TOKEN}" ]; then
codecov -t \$CODECOV_TOKEN
if [ -n "${CODECOV_TOKEN}" ]; then
codecov -t $CODECOV_TOKEN
fi

gpuci_logger "gpu/build.sh returning value: $EXITCODE"
return ${EXITCODE}
20 changes: 16 additions & 4 deletions ci/gpu/test-notebooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#RAPIDS_DIR=/rapids
# Any failing command will set EXITCODE to non-zero
set -e # abort the script on error, this will change for running tests (see below)
set -o pipefail # piped commands propagate their error
set -E # ERR traps are inherited by subcommands
trap "EXITCODE=1" ERR

NOTEBOOKS_DIR=${WORKSPACE}/notebooks
NBTEST=${WORKSPACE}/ci/utils/nbtest.sh
LIBCUDF_KERNEL_CACHE_PATH=${WORKSPACE}/.jitcache
EXITCODE=0

cd ${NOTEBOOKS_DIR}
TOPLEVEL_NB_FOLDERS=$(find . -name *.ipynb |cut -d'/' -f2|sort -u)

## Check env
env

EXITCODE=0
# Do not abort the script on error. This allows all tests to run regardless of
# pass/fail but relies on the ERR trap above to manage the EXITCODE for the
# script.
set +e

# Always run nbtest in all TOPLEVEL_NB_FOLDERS, set EXITCODE to failure
# if any run fails
Expand All @@ -32,17 +41,20 @@ for folder in ${TOPLEVEL_NB_FOLDERS}; do
echo "FOLDER: ${folder}"
echo "========================================"
cd ${NOTEBOOKS_DIR}/${folder}
for nb in $(python ${WORKSPACE}/ci/gpu/notebook_list.py); do
NBLIST=$(python ${WORKSPACE}/ci/gpu/notebook_list.py)
for nb in ${NBLIST}; do
nbBasename=$(basename ${nb})
cd $(dirname ${nb})
nvidia-smi
${NBTEST} ${nbBasename}
EXITCODE=$((EXITCODE | $?))
echo "Ran nbtest for $nb : return code was: $?, test script exit code is now: $EXITCODE"
echo
rm -rf ${LIBCUDF_KERNEL_CACHE_PATH}/*
cd ${NOTEBOOKS_DIR}/${folder}
done
done

nvidia-smi

echo "Notebook test script exiting with value: $EXITCODE"
exit ${EXITCODE}
49 changes: 29 additions & 20 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# note: do not use set -e in order to allow all gtest invocations to take place,
# and instead keep track of exit status and exit with an overall exit status
set -o pipefail
# Any failing command will set EXITCODE to non-zero
set -e # abort the script on error, this will change for running tests (see below)
set -o pipefail # piped commands propagate their error
set -E # ERR traps are inherited by subcommands
trap "EXITCODE=1" ERR

NUMARGS=$#
ARGS=$*
THISDIR=$(cd $(dirname $0);pwd)
CUGRAPH_ROOT=$(cd ${THISDIR}/..;pwd)
GTEST_ARGS="--gtest_output=xml:${CUGRAPH_ROOT}/test-results/"
DOWNLOAD_MODE=""
ERRORCODE=0
EXITCODE=0

export RAPIDS_DATASET_ROOT_DIR=${CUGRAPH_ROOT}/datasets

Expand Down Expand Up @@ -50,27 +52,20 @@ else
echo "Download datasets..."
cd ${RAPIDS_DATASET_ROOT_DIR}
bash ./get_test_data.sh ${DOWNLOAD_MODE}
ERRORCODE=$((ERRORCODE | $?))
# no need to run tests if dataset download fails
if (( ${ERRORCODE} != 0 )); then
exit ${ERRORCODE}
fi
fi

if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
cd ${CUGRAPH_ROOT}/cpp/build
else
export LD_LIBRARY_PATH="$WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build:$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd $WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build
fi

for gt in tests/*_TEST; do
test_name=$(basename $gt)
echo "Running GoogleTest $test_name"
${gt} ${GTEST_FILTER} ${GTEST_ARGS}
ERRORCODE=$((ERRORCODE | $?))
done

# FIXME: if possible, any install and build steps should be moved outside this
# script since a failing install/build step is treated as a failing test command
# and will not stop the script. This script is also only expected to run tests
# in a preconfigured environment, and install/build steps are unexpected side
# effects.
if [[ "$PROJECT_FLASH" == "1" ]]; then
CONDA_FILE=`find $WORKSPACE/ci/artifacts/cugraph/cpu/conda-bld/ -name "libcugraph*.tar.bz2"`
CONDA_FILE=`basename "$CONDA_FILE" .tar.bz2` #get filename without extension
Expand All @@ -83,14 +78,28 @@ if [[ "$PROJECT_FLASH" == "1" ]]; then
$WORKSPACE/build.sh cugraph
fi

# Do not abort the script on error from this point on. This allows all tests to
# run regardless of pass/fail, but relies on the ERR trap above to manage the
# EXITCODE for the script.
set +e

echo "C++ gtests for cuGraph..."
for gt in tests/*_TEST; do
test_name=$(basename $gt)
echo "Running gtest $test_name"
${gt} ${GTEST_FILTER} ${GTEST_ARGS}
echo "Ran gtest $test_name : return code was: $?, test script exit code is now: $EXITCODE"
done

echo "Python pytest for cuGraph..."
cd ${CUGRAPH_ROOT}/python
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-cugraph.xml -v --cov-config=.coveragerc --cov=cugraph --cov-report=xml:${WORKSPACE}/python/cugraph/cugraph-coverage.xml --cov-report term --ignore=cugraph/raft --benchmark-disable
ERRORCODE=$((ERRORCODE | $?))
echo "Ran Python pytest for cugraph : return code was: $?, test script exit code is now: $EXITCODE"

echo "Python benchmarks for cuGraph (running as tests)..."
cd ${CUGRAPH_ROOT}/benchmarks
pytest -v -m "managedmem_on and poolallocator_on and tiny" --benchmark-disable
ERRORCODE=$((ERRORCODE | $?))
echo "Ran Python benchmarks for cuGraph (running as tests) : return code was: $?, test script exit code is now: $EXITCODE"

exit ${ERRORCODE}
echo "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
16 changes: 14 additions & 2 deletions ci/utils/nbtest.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -12,6 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Any failing command will set EXITCODE to non-zero
set +e # do not abort the script on error
set -o pipefail # piped commands propagate their error
set -E # ERR traps are inherited by subcommands
trap "EXITCODE=1" ERR

# Prepend the following code to all scripts generated from nbconvert. This
# allows all cell and line magic code to run and update the namespace as if
# running in jupyter, but will also tolerate failures due to running in a
# non-jupyter env.
# Note: depending on the assumptions of the notebook script, ignoring failures
# may not be acceptable (meaning the converted notebook simply cannot run
# outside of jupyter as-is), hence the warning.
MAGIC_OVERRIDE_CODE="
def my_run_line_magic(*args, **kwargs):
g=globals()
Expand Down Expand Up @@ -58,7 +71,6 @@ for nb in $*; do
NBEXITCODE=$?
echo EXIT CODE: ${NBEXITCODE}
echo
EXITCODE=$((EXITCODE | ${NBEXITCODE}))
done

exit ${EXITCODE}

0 comments on commit 3f1bd86

Please sign in to comment.