From 68d34aff543b780b4585e1314b35d27c545ed5a4 Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Wed, 22 Apr 2020 16:20:50 -0700 Subject: [PATCH 1/6] add option for per-thread default stream --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31462ccfb..366761d50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,13 @@ if(USE_NVTX) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --define-macro USE_NVTX") endif(USE_NVTX) +option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) +if(PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") +endif(PER_THREAD_DEFAULT_STREAM) + ################################################################################################### # - link libraries -------------------------------------------------------------------------------- From 4bb9b42641fa08f2e9a093ba0d7c8e800a48b3ce Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Fri, 24 Apr 2020 11:08:49 -0700 Subject: [PATCH 2/6] add ptds option to tests and benchmarks --- benchmarks/CMakeLists.txt | 10 ++++++++++ tests/CMakeLists.txt | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 943fa5e21..ca31114b6 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -37,6 +37,16 @@ link_directories("${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}" # CMAKE_CUDA_IMPLICIT "${GTEST_LIBRARY_DIR}" "${GBENCH_LIBRARY_DIR}") +################################################################################################### +# - build options --------------------------------------------------------------------------------- + +option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) +if(PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") +endif(PER_THREAD_DEFAULT_STREAM) + ################################################################################################### ### test sources ################################################################################## ################################################################################################### diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 94db1fa79..f39d4fd29 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,6 +53,16 @@ link_directories("${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}" # CMAKE_CUDA_IMPLICIT "${CMAKE_BINARY_DIR}/lib" "${GTEST_LIBRARY_DIR}") +################################################################################################### +# - build options --------------------------------------------------------------------------------- + +option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) +if(PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") +endif(PER_THREAD_DEFAULT_STREAM) + ################################################################################################### ### test sources ################################################################################## ################################################################################################### From b0c67d4b964f88211d51333aca10040064517689 Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Fri, 24 Apr 2020 12:01:11 -0700 Subject: [PATCH 3/6] add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7350d72b1..0c74783eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - PR #343 Add in option to statically link against cudart ## Improvements +- PR #354 Add CMake option for per-thread default stream - PR #350 Add .clang-format file & format all files ## Bug Fixes From 3ca09809a6cb1a1cc96137407615f1d5ae5fd498 Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Mon, 27 Apr 2020 14:12:57 -0700 Subject: [PATCH 4/6] Update CHANGELOG.md Co-Authored-By: Keith Kraus --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c74783eb..1ccd2caf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - PR #343 Add in option to statically link against cudart ## Improvements + - PR #354 Add CMake option for per-thread default stream - PR #350 Add .clang-format file & format all files From 84abf9e4f2ffd62e6b8578970dfb4af2c3caaac5 Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Tue, 28 Apr 2020 10:43:34 -0700 Subject: [PATCH 5/6] define ptds option once --- CMakeLists.txt | 10 ++++++++++ benchmarks/CMakeLists.txt | 10 ---------- tests/CMakeLists.txt | 10 ---------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 366761d50..a86bd9d5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,16 @@ include(FeatureSummary) include(CheckIncludeFiles) include(CheckLibraryExists) +################################################################################################### +# - per-thread default stream option -------------------------------------------------------------- +# This needs to be defined first so tests and benchmarks can inherit it. + +option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) +if(PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) +endif(PER_THREAD_DEFAULT_STREAM) + ################################################################################################### # - add gtest ------------------------------------------------------------------------------------- diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index ca31114b6..943fa5e21 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -37,16 +37,6 @@ link_directories("${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}" # CMAKE_CUDA_IMPLICIT "${GTEST_LIBRARY_DIR}" "${GBENCH_LIBRARY_DIR}") -################################################################################################### -# - build options --------------------------------------------------------------------------------- - -option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) -if(PER_THREAD_DEFAULT_STREAM) - message(STATUS "Using per-thread default stream") - add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") -endif(PER_THREAD_DEFAULT_STREAM) - ################################################################################################### ### test sources ################################################################################## ################################################################################################### diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f39d4fd29..94db1fa79 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,16 +53,6 @@ link_directories("${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}" # CMAKE_CUDA_IMPLICIT "${CMAKE_BINARY_DIR}/lib" "${GTEST_LIBRARY_DIR}") -################################################################################################### -# - build options --------------------------------------------------------------------------------- - -option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) -if(PER_THREAD_DEFAULT_STREAM) - message(STATUS "Using per-thread default stream") - add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") -endif(PER_THREAD_DEFAULT_STREAM) - ################################################################################################### ### test sources ################################################################################## ################################################################################################### From e726913511bbad405aca75943a5e4f7483ab091f Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Tue, 28 Apr 2020 10:45:04 -0700 Subject: [PATCH 6/6] remove redundant option --- CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a86bd9d5c..cc5e1e214 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,13 +171,6 @@ if(USE_NVTX) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --define-macro USE_NVTX") endif(USE_NVTX) -option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) -if(PER_THREAD_DEFAULT_STREAM) - message(STATUS "Using per-thread default stream") - add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread") -endif(PER_THREAD_DEFAULT_STREAM) - ################################################################################################### # - link libraries --------------------------------------------------------------------------------