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

Always enable per-thread default stream #11281

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)

VALIDARGS="clean libcudf cudf cudfjar dask_cudf benchmarks tests libcudf_kafka cudf_kafka custreamz -v -g -n -l --allgpuarch --disable_nvtx --opensource_nvcomp --show_depr_warn --ptds -h --build_metrics --incl_cache_stats"
VALIDARGS="clean libcudf cudf cudfjar dask_cudf benchmarks tests libcudf_kafka cudf_kafka custreamz -v -g -n -l --allgpuarch --disable_nvtx --opensource_nvcomp --show_depr_warn -h --build_metrics --incl_cache_stats"
HELP="$0 [clean] [libcudf] [cudf] [cudfjar] [dask_cudf] [benchmarks] [tests] [libcudf_kafka] [cudf_kafka] [custreamz] [-v] [-g] [-n] [-h] [--cmake-args=\\\"<args>\\\"]
clean - remove all existing build artifacts and configuration (start
over)
Expand All @@ -37,7 +37,6 @@ HELP="$0 [clean] [libcudf] [cudf] [cudfjar] [dask_cudf] [benchmarks] [tests] [li
--disable_nvtx - disable inserting NVTX profiling ranges
--opensource_nvcomp - disable use of proprietary nvcomp extensions
--show_depr_warn - show cmake deprecation warnings
--ptds - enable per-thread default stream
--build_metrics - generate build metrics report for libcudf
--incl_cache_stats - include cache statistics in build metrics report
--cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument)
Expand Down Expand Up @@ -150,7 +149,6 @@ function buildLibCudfJniInDocker {
-DCUDF_USE_ARROW_STATIC=ON \
-DCUDF_ENABLE_ARROW_S3=OFF \
-DBUILD_TESTS=OFF \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=ON \
-DRMM_LOGGING_LEVEL=OFF \
-DBUILD_SHARED_LIBS=OFF && \
cmake --build . --parallel ${PARALLEL_LEVEL} && \
Expand All @@ -165,7 +163,6 @@ function buildLibCudfJniInDocker {
-DCMAKE_CXX_LINKER_LAUNCHER=ccache' \
-DCUDF_CPP_BUILD_DIR=$workspaceRepoDir/java/target/libcudf-cmake-build \
-DCUDA_STATIC_RUNTIME=ON \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=ON \
-DUSE_GDS=ON \
-DGPU_ARCHS=${CUDF_CMAKE_CUDA_ARCHITECTURES} \
-DCUDF_JNI_LIBCUDF_STATIC=ON \
Expand Down Expand Up @@ -218,9 +215,6 @@ fi
if hasArg --show_depr_warn; then
BUILD_DISABLE_DEPRECATION_WARNING=OFF
fi
if hasArg --ptds; then
BUILD_PER_THREAD_DEFAULT_STREAM=ON
fi
if hasArg --build_metrics; then
BUILD_REPORT_METRICS=ON
fi
Expand Down Expand Up @@ -286,7 +280,6 @@ if buildAll || hasArg libcudf; then
-DBUILD_TESTS=${BUILD_TESTS} \
-DBUILD_BENCHMARKS=${BUILD_BENCHMARKS} \
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=${BUILD_PER_THREAD_DEFAULT_STREAM} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
${EXTRA_CMAKE_ARGS}

Expand Down
2 changes: 1 addition & 1 deletion ci/benchmark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ conda list --show-channel-urls
################################################################################

logger "Build libcudf..."
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf benchmarks tests --ptds
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf benchmarks tests

################################################################################
# BENCHMARK - Run and parse libcudf and cuDF benchmarks
Expand Down
2 changes: 1 addition & 1 deletion ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
################################################################################

gpuci_logger "Build from source"
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests --ptds
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests

################################################################################
# TEST - Run GoogleTest
Expand Down
16 changes: 3 additions & 13 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ option(CUDF_ENABLE_ARROW_ORC "Build the Arrow ORC adapter" OFF)
option(CUDF_ENABLE_ARROW_PYTHON "Find (or build) Arrow with Python support" OFF)
option(CUDF_ENABLE_ARROW_PARQUET "Find (or build) Arrow with Parquet support" OFF)
option(CUDF_ENABLE_ARROW_S3 "Build/Enable AWS S3 Arrow filesystem support" ON)
option(
CUDF_USE_PER_THREAD_DEFAULT_STREAM
"Build cuDF with per-thread default stream, including passing the per-thread default
stream to external libraries."
OFF
)
option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF)
# Option to enable line info in CUDA device compilation to allow introspection when profiling /
# memchecking
Expand All @@ -70,7 +64,6 @@ message(VERBOSE "CUDF: Build cuDF shared libraries: ${BUILD_SHARED_LIBS}")
message(VERBOSE "CUDF: Use a file cache for JIT compiled kernels: ${JITIFY_USE_CACHE}")
message(VERBOSE "CUDF: Build and statically link Arrow libraries: ${CUDF_USE_ARROW_STATIC}")
message(VERBOSE "CUDF: Build and enable S3 filesystem support for Arrow: ${CUDF_ENABLE_ARROW_S3}")
message(VERBOSE "CUDF: Build with per-thread default stream: ${CUDF_USE_PER_THREAD_DEFAULT_STREAM}")
message(
VERBOSE
"CUDF: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}"
Expand Down Expand Up @@ -545,7 +538,6 @@ add_library(
src/unary/math_ops.cu
src/unary/nan_ops.cu
src/unary/null_ops.cu
src/utilities/default_stream.cpp
src/utilities/type_checks.cpp
)

Expand Down Expand Up @@ -594,11 +586,9 @@ if(JITIFY_USE_CACHE)
endif()

# Per-thread default stream
if(CUDF_USE_PER_THREAD_DEFAULT_STREAM)
target_compile_definitions(
cudf PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM CUDF_USE_PER_THREAD_DEFAULT_STREAM
)
endif()
target_compile_definitions(
cudf PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM
)

# Disable NVTX if necessary
if(NOT USE_NVTX)
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_nvcomp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function(find_and_configure_nvcomp)
)

# Per-thread default stream
if(TARGET nvcomp AND CUDF_USE_PER_THREAD_DEFAULT_STREAM)
if(TARGET nvcomp)
target_compile_definitions(nvcomp PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM)
endif()
endfunction()
Expand Down
11 changes: 0 additions & 11 deletions cpp/include/cudf/utilities/default_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ namespace cudf {
* Use this value to ensure the correct stream is used when compiled with per
* thread default stream.
*/
#if defined(CUDF_USE_PER_THREAD_DEFAULT_STREAM)
static const rmm::cuda_stream_view default_stream_value{rmm::cuda_stream_per_thread};
#else
static constexpr rmm::cuda_stream_view default_stream_value{};
#endif

/**
* @brief Check if per-thread default stream is enabled.
*
* @return true if PTDS is enabled, false otherwise.
*/
bool is_ptds_enabled();

} // namespace cudf
35 changes: 0 additions & 35 deletions cpp/src/utilities/default_stream.cpp

This file was deleted.

1 change: 0 additions & 1 deletion cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ ConfigureTest(
utilities_tests/column_utilities_tests.cpp
utilities_tests/column_wrapper_tests.cpp
utilities_tests/lists_column_wrapper_tests.cpp
utilities_tests/default_stream_tests.cpp
utilities_tests/type_check_tests.cpp
)

Expand Down
25 changes: 0 additions & 25 deletions cpp/tests/utilities_tests/default_stream_tests.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ Since the PTDS option is for each compilation unit, it should be done at the sam
whole codebase. To enable PTDS, first build cuDF:
```shell script
cd src/cudf/cpp/build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCUDF_USE_PER_THREAD_DEFAULT_STREAM=ON
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
make -j`nproc`
make install
```

then build the jar:
```shell script
cd src/cudf/java
mvn clean install -DCUDF_USE_PER_THREAD_DEFAULT_STREAM=ON
mvn clean install
```

## GPUDirect Storage (GDS)
Expand Down
4 changes: 0 additions & 4 deletions java/ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ gcc --version
SKIP_JAVA_TESTS=${SKIP_JAVA_TESTS:-true}
BUILD_CPP_TESTS=${BUILD_CPP_TESTS:-OFF}
ENABLE_CUDA_STATIC_RUNTIME=${ENABLE_CUDA_STATIC_RUNTIME:-ON}
ENABLE_PTDS=${ENABLE_PTDS:-ON}
RMM_LOGGING_LEVEL=${RMM_LOGGING_LEVEL:-OFF}
ENABLE_NVTX=${ENABLE_NVTX:-ON}
ENABLE_GDS=${ENABLE_GDS:-OFF}
Expand All @@ -38,7 +37,6 @@ echo "SIGN_FILE: $SIGN_FILE,\
SKIP_JAVA_TESTS: $SKIP_JAVA_TESTS,\
BUILD_CPP_TESTS: $BUILD_CPP_TESTS,\
ENABLE_CUDA_STATIC_RUNTIME: $ENABLE_CUDA_STATIC_RUNTIME,\
ENABLED_PTDS: $ENABLE_PTDS,\
ENABLE_NVTX: $ENABLE_NVTX,\
ENABLE_GDS: $ENABLE_GDS,\
RMM_LOGGING_LEVEL: $RMM_LOGGING_LEVEL,\
Expand All @@ -61,7 +59,6 @@ cmake .. -G"${CMAKE_GENERATOR}" \
-DCUDF_USE_ARROW_STATIC=ON \
-DCUDF_ENABLE_ARROW_S3=OFF \
-DBUILD_TESTS=$BUILD_CPP_TESTS \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=$ENABLE_PTDS \
-DRMM_LOGGING_LEVEL=$RMM_LOGGING_LEVEL \
-DBUILD_SHARED_LIBS=OFF

Expand All @@ -75,7 +72,6 @@ cmake --install .
###### Build cudf jar ######
BUILD_ARG="-Dmaven.repo.local=\"$WORKSPACE/.m2\"\
-DskipTests=$SKIP_JAVA_TESTS\
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=$ENABLE_PTDS\
-DCUDA_STATIC_RUNTIME=$ENABLE_CUDA_STATIC_RUNTIME\
-DCUDF_JNI_LIBCUDF_STATIC=ON\
-DUSE_GDS=$ENABLE_GDS -Dtest=*,!CuFileTest,!CudaFatalTest"
Expand Down
2 changes: 0 additions & 2 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
<cxx.flags/>
<CMAKE_EXPORT_COMPILE_COMMANDS>OFF</CMAKE_EXPORT_COMPILE_COMMANDS>
<CUDA_STATIC_RUNTIME>OFF</CUDA_STATIC_RUNTIME>
<CUDF_USE_PER_THREAD_DEFAULT_STREAM>OFF</CUDF_USE_PER_THREAD_DEFAULT_STREAM>
<USE_GDS>OFF</USE_GDS>
<GPU_ARCHS>ALL</GPU_ARCHS>
<CUDF_JNI_LIBCUDF_STATIC>OFF</CUDF_JNI_LIBCUDF_STATIC>
Expand Down Expand Up @@ -449,7 +448,6 @@
<arg value="${basedir}/src/main/native"/>
<arg line="${cmake.ccache.opts}"/>
<arg value="-DCUDA_STATIC_RUNTIME=${CUDA_STATIC_RUNTIME}" />
<arg value="-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=${CUDF_USE_PER_THREAD_DEFAULT_STREAM}" />
<arg value="-DUSE_GDS=${USE_GDS}" />
<arg value="-DCMAKE_CXX_FLAGS=${cxx.flags}"/>
<arg value="-DCMAKE_EXPORT_COMPILE_COMMANDS=${CMAKE_EXPORT_COMPILE_COMMANDS}"/>
Expand Down
9 changes: 1 addition & 8 deletions java/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ project(
option(USE_NVTX "Build with NVTX support" ON)
option(BUILD_SHARED_LIBS "Build cuDF JNI shared libraries" ON)
option(BUILD_TESTS "Configure CMake to build tests" ON)
option(CUDF_USE_PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
option(USE_GDS "Build with GPUDirect Storage (GDS)/cuFile support" OFF)
option(CUDF_JNI_LIBCUDF_STATIC "Link with libcudf.a" OFF)

message(VERBOSE "CUDF_JNI: Build with NVTX support: ${USE_NVTX}")
message(VERBOSE "CUDF_JNI: Build cuDF JNI shared libraries: ${BUILD_SHARED_LIBS}")
message(VERBOSE "CUDF_JNI: Configure CMake to build tests: ${BUILD_TESTS}")
message(VERBOSE
"CUDF_JNI: Build with per-thread default stream: ${CUDF_USE_PER_THREAD_DEFAULT_STREAM}"
)
message(VERBOSE "CUDF_JNI: Statically link the CUDA runtime: ${CUDA_STATIC_RUNTIME}")
message(VERBOSE "CUDF_JNI: Build with GPUDirect Storage support: ${USE_GDS}")
message(VERBOSE "CUDF_JNI: Link with libcudf statically: ${CUDF_JNI_LIBCUDF_STATIC}")
Expand Down Expand Up @@ -82,10 +78,7 @@ if(NOT USE_NVTX)
target_compile_definitions(cudfjni PUBLIC NVTX_DISABLE)
endif()

if(CUDF_USE_PER_THREAD_DEFAULT_STREAM)
message(STATUS "Using per-thread default stream")
add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM CUDF_USE_PER_THREAD_DEFAULT_STREAM)
endif()
add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM)

# ##################################################################################################
# * build type ------------------------------------------------------------------------------------
Expand Down
22 changes: 1 addition & 21 deletions java/src/main/native/src/CudfJni.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,12 +39,6 @@ class jvm_detach_on_destruct {
namespace cudf {
namespace jni {

#ifdef CUDA_API_PER_THREAD_DEFAULT_STREAM
constexpr bool is_ptds_enabled{true};
#else
constexpr bool is_ptds_enabled{false};
#endif

static jclass Host_memory_buffer_jclass;
static jmethodID Host_buffer_allocate;
static jfieldID Host_buffer_address;
Expand Down Expand Up @@ -145,16 +139,6 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
return JNI_ERR;
}

// make sure libcudf and the JNI library are built with the same PTDS mode
if (cudf::is_ptds_enabled() != cudf::jni::is_ptds_enabled) {
std::ostringstream ss;
ss << "Libcudf is_ptds_enabled=" << cudf::is_ptds_enabled()
<< ", which does not match cudf jni is_ptds_enabled=" << cudf::jni::is_ptds_enabled
<< ". They need to be built with the same per-thread default stream flag.";
env->ThrowNew(env->FindClass("java/lang/RuntimeException"), ss.str().c_str());
return JNI_ERR;
}

// cache any class objects and method IDs here
if (!cudf::jni::cache_contiguous_table_jni(env)) {
if (!env->ExceptionCheck()) {
Expand Down Expand Up @@ -186,8 +170,4 @@ JNIEXPORT void JNI_OnUnload(JavaVM *vm, void *) {
cudf::jni::release_host_memory_buffer_jni(env);
}

JNIEXPORT jboolean JNICALL Java_ai_rapids_cudf_Cuda_isPtdsEnabled(JNIEnv *env, jclass, jlong size) {
return cudf::jni::is_ptds_enabled;
}

} // extern "C"