Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split C++ tests into separate binaries #4295

Merged
merged 14 commits into from
Feb 18, 2022
37 changes: 2 additions & 35 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ BUILD_CUML_MG_TESTS=OFF
BUILD_STATIC_FAISS=OFF
BUILD_STATIC_TREELITE=OFF
CMAKE_LOG_LEVEL=WARNING
DISABLE_FORCE_CLONE_RAFT=OFF

# Set defaults for vars that may not have been defined externally
# FIXME: if INSTALL_PREFIX is not set, check PREFIX, then check
Expand Down Expand Up @@ -163,7 +162,7 @@ while true; do
exit 0
;;
-v | --verbose )
VERBOSE=true
VERBOSE_FLAG="-v"
CMAKE_LOG_LEVEL=VERBOSE
;;
-g | --debug )
Expand Down Expand Up @@ -256,7 +255,6 @@ if completeBuild || hasArg libcuml || hasArg prims || hasArg bench || hasArg pri
-DBUILD_CUML_MG_TESTS=${BUILD_CUML_MG_TESTS} \
-DCUML_USE_FAISS_STATIC=${BUILD_STATIC_FAISS} \
-DCUML_USE_TREELITE_STATIC=${BUILD_STATIC_TREELITE} \
-DDISABLE_FORCE_CLONE_RAFT=${DISABLE_FORCE_CLONE_RAFT} \
-DNVTX=${NVTX} \
-DUSE_CCACHE=${CCACHE} \
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
Expand All @@ -266,41 +264,10 @@ if completeBuild || hasArg libcuml || hasArg prims || hasArg bench || hasArg pri
..
fi

# Run all make targets at once

MAKE_TARGETS=
if hasArg libcuml; then
MAKE_TARGETS="${MAKE_TARGETS}cuml++ cuml"
if ! hasArg --nolibcumltest; then
MAKE_TARGETS="${MAKE_TARGETS} ml"
fi
fi
if hasArg cpp-mgtests; then
MAKE_TARGETS="${MAKE_TARGETS} ml_mg"
fi
if hasArg prims; then
MAKE_TARGETS="${MAKE_TARGETS} prims"
fi
if hasArg bench; then
MAKE_TARGETS="${MAKE_TARGETS} sg_benchmark"
fi
if hasArg prims-bench; then
MAKE_TARGETS="${MAKE_TARGETS} prims_benchmark"
fi

# If `./build.sh cuml` is called, don't build C/C++ components
if completeBuild || hasArg libcuml || hasArg prims || hasArg bench || hasArg cpp-mgtests; then
cd ${LIBCUML_BUILD_DIR}
build_args="--target ${MAKE_TARGETS} ${INSTALL_TARGET}"
if [ ! -z ${VERBOSE} ]
then
build_args="-v ${build_args}"
fi
if [ ! -z ${PARALLEL_LEVEL} ]
then
build_args="-j${PARALLEL_LEVEL} ${build_args}"
fi
cmake --build ${LIBCUML_BUILD_DIR} ${build_args}
cmake --build ${LIBCUML_BUILD_DIR} -j${PARALLEL_LEVEL} ${build_args} --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
fi

if hasArg cppdocs; then
Expand Down
28 changes: 22 additions & 6 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,22 @@ else
patchelf --replace-needed `patchelf --print-needed libcuml++.so | grep faiss` libfaiss.so libcuml++.so

cd $LIBCUML_BUILD_DIR
chrpath -d ./test/ml
patchelf --replace-needed `patchelf --print-needed ./test/ml | grep faiss` libfaiss.so ./test/ml
cp _deps/raft-build/libraft_nn.so $PWD
patchelf --replace-needed `patchelf --print-needed libraft_nn.so | grep faiss` libfaiss.so libraft_nn.so
cp _deps/raft-build/libraft_distance.so $PWD

gpuci_logger "Running libcuml binaries"
GTEST_OUTPUT="xml:${WORKSPACE}/test-results/libcuml_cpp/" ./test/ml
GTEST_ARGS="xml:${WORKSPACE}/test-results/libcuml_cpp/"
for gt in $(find ./test -name "*_TEST" | grep -v "PRIMS_" || true); do
test_name=$(basename $gt)
echo "Patching gtest $test_name"
chrpath -d ${gt}
patchelf --replace-needed `patchelf --print-needed ${gt} | grep faiss` libfaiss.so ${gt}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but why do we need to do this?

echo "Running gtest $test_name"
${gt} ${GTEST_ARGS}
echo "Ran gtest $test_name : return code was: $?, test script exit code is now: $EXITCODE"
done


CONDA_FILE=`find ${CONDA_ARTIFACT_PATH} -name "libcuml*.tar.bz2"`
CONDA_FILE=`basename "$CONDA_FILE" .tar.bz2` #get filename without extension
Expand Down Expand Up @@ -250,9 +258,17 @@ else

gpuci_logger "Run ml-prims test"
cd $LIBCUML_BUILD_DIR
chrpath -d ./test/prims
patchelf --replace-needed `patchelf --print-needed ./test/prims | grep faiss` libfaiss.so ./test/prims
GTEST_OUTPUT="xml:${WORKSPACE}/test-results/prims/" ./test/prims
GTEST_ARGS="xml:${WORKSPACE}/test-results/prims/"
for gt in $(find ./test -name "*_TEST" | grep -v "SG_\|MG_" || true); do
test_name=$(basename $gt)
echo "Patching gtest $test_name"
chrpath -d ${gt}
patchelf --replace-needed `patchelf --print-needed ${gt} | grep faiss` libfaiss.so ${gt}
echo "Running gtest $test_name"
${gt} ${GTEST_ARGS}
echo "Ran gtest $test_name : return code was: $?, test script exit code is now: $EXITCODE"
done


################################################################################
# TEST - Run GoogleTest for ml-prims, but with cuda-memcheck enabled
Expand Down
Loading