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

Move stream-related test configuration to CMake #13513

Merged
merged 15 commits into from
Jun 9, 2023
Merged
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ python/dask_cudf/ @rapidsai/cudf-dask-codeowners

#cmake code owners
cpp/CMakeLists.txt @rapidsai/cudf-cmake-codeowners
cpp/tests/CMakeLists.txt @rapidsai/cudf-cmake-codeowners
vyasr marked this conversation as resolved.
Show resolved Hide resolved
cpp/benchmarks/CMakeLists.txt @rapidsai/cudf-cmake-codeowners
cpp/libcudf_kafka/CMakeLists.txt @rapidsai/cudf-cmake-codeowners
**/cmake/ @rapidsai/cudf-cmake-codeowners

Expand Down
16 changes: 1 addition & 15 deletions ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,13 @@ EXITCODE=0
trap "EXITCODE=1" ERR
set +e

# Get library for finding incorrect default stream usage.
STREAM_IDENTIFY_LIB_MODE_CUDF="${CONDA_PREFIX}/lib/libcudf_identify_stream_usage_mode_cudf.so"
STREAM_IDENTIFY_LIB_MODE_TESTING="${CONDA_PREFIX}/lib/libcudf_identify_stream_usage_mode_testing.so"

echo "STREAM_IDENTIFY_LIB=${STREAM_IDENTIFY_LIB_MODE_CUDF}"

# Run libcudf and libcudf_kafka gtests from libcudf-tests package
rapids-logger "Run gtests"

cd $CONDA_PREFIX/bin/gtests/libcudf/
export GTEST_CUDF_STREAM_MODE="new_cudf_default"
export GTEST_OUTPUT=xml:${RAPIDS_TESTS_DIR}/
export LD_PRELOAD=${STREAM_IDENTIFY_LIB_MODE_CUDF}

ctest -E SPAN_TEST -j20 --output-on-failure

# This one test is specifically designed to test using a thrust device vector,
# so we expect and allow it to include default stream usage.
_allowlist_filter="SpanTest.CanConstructFromDeviceContainers"
GTEST_FILTER="-${_allowlist_filter}" ctest -R SPAN_TEST -VV
LD_PRELOAD= GTEST_CUDF_STREAM_MODE=default GTEST_FILTER="${_allowlist_filter}" ctest -R SPAN_TEST -VV
ctest -j20 --output-on-failure -VV

SUITEERROR=$?

Expand Down
34 changes: 32 additions & 2 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rapids_test_init()
# properties and linking to build the test
function(ConfigureTest CMAKE_TEST_NAME)
set(options)
set(one_value GPUS PERCENT)
set(one_value GPUS PERCENT STREAM_MODE)
set(multi_value)
cmake_parse_arguments(_CUDF_TEST "${options}" "${one_value}" "${multi_value}" ${ARGN})
if(NOT DEFINED _CUDF_TEST_GPUS AND NOT DEFINED _CUDF_TEST_PERCENT)
Expand All @@ -37,6 +37,9 @@ function(ConfigureTest CMAKE_TEST_NAME)
if(NOT DEFINED _CUDF_TEST_PERCENT)
set(_CUDF_TEST_PERCENT 100)
endif()
if(NOT DEFINED _CUDF_TEST_STREAM_MODE)
set(_CUDF_TEST_STREAM_MODE cudf)
endif()

add_executable(${CMAKE_TEST_NAME} ${_CUDF_TEST_UNPARSED_ARGUMENTS})
set_target_properties(
Expand All @@ -62,6 +65,15 @@ function(ConfigureTest CMAKE_TEST_NAME)
PERCENT ${_CUDF_TEST_PERCENT}
INSTALL_COMPONENT_SET testing
)

# TODO: Will this work both inside the build directory and when the libcudf/libcudf-tests packages
# are installed from conda?
set_tests_properties(
${CMAKE_TEST_NAME}
PROPERTIES
ENVIRONMENT
"GTEST_CUDF_STREAM_MODE=new_${_CUDF_TEST_STREAM_MODE}_default;LD_PRELOAD=$<TARGET_FILE:cudf_identify_stream_usage_mode_${_CUDF_TEST_STREAM_MODE}>"
)
endfunction()

# ##################################################################################################
Expand Down Expand Up @@ -349,7 +361,25 @@ ConfigureTest(

# ##################################################################################################
# * span tests -------------------------------------------------------------------------------

# This test must be split into two executables so that one can use the preload library and one does
# not. The one that doesn't includes a thrust::device_vector copy, which is always synchronous on
# the default stream and is out of libcudf's control (but must be tested).
set(_allowlist_filter SpanTest.CanConstructFromDeviceContainers)

ConfigureTest(SPAN_TEST utilities_tests/span_tests.cu)
ConfigureTest(SPAN_TEST_DEVICE_VECTOR utilities_tests/span_tests.cu)

# Overwrite the environments set by ConfigureTest
set_tests_properties(
SPAN_TEST
PROPERTIES
ENVIRONMENT
"GTEST_FILTER=-${_allowlist_filter};GTEST_CUDF_STREAM_MODE=new_cudf_default;LD_PRELOAD=$<TARGET_FILE:cudf_identify_stream_usage_mode_cudf>"
)
set_tests_properties(
SPAN_TEST_DEVICE_VECTOR PROPERTIES ENVIRONMENT "GTEST_FILTER=${_allowlist_filter}"
)

# ##################################################################################################
# * iterator tests --------------------------------------------------------------------------------
Expand Down Expand Up @@ -578,7 +608,7 @@ ConfigureTest(
ConfigureTest(LABEL_BINS_TEST labeling/label_bins_tests.cpp)

# ##################################################################################################
# * stream identification tests -------------------------------------------------------------------
# * stream testing ---------------------------------------------------------------------------------
ConfigureTest(
STREAM_IDENTIFICATION_TEST identify_stream_usage/test_default_stream_identification.cu
)
Expand Down