From b19578778a25cc301a1b67d9ea6b896121a8c7d3 Mon Sep 17 00:00:00 2001 From: Patrick Stotko Date: Mon, 28 Oct 2019 09:38:49 +0100 Subject: [PATCH 1/2] test: Collect backend-specific files in separate CMake file --- test/stdgpu/CMakeLists.txt | 7 +++---- test/stdgpu/cuda/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 test/stdgpu/cuda/CMakeLists.txt diff --git a/test/stdgpu/CMakeLists.txt b/test/stdgpu/CMakeLists.txt index 27e2b7174..84b2be521 100644 --- a/test/stdgpu/CMakeLists.txt +++ b/test/stdgpu/CMakeLists.txt @@ -1,9 +1,9 @@ add_executable(teststdgpu main.cpp) -target_sources(teststdgpu PRIVATE cuda/atomic.cu - cuda/bit.cu - algorithm.cpp +add_subdirectory(cuda) + +target_sources(teststdgpu PRIVATE algorithm.cpp atomic.cu bit.cpp bitset.cu @@ -21,7 +21,6 @@ target_sources(teststdgpu PRIVATE cuda/atomic.cu vector.cu) target_include_directories(teststdgpu PRIVATE - ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} "${CMAKE_CURRENT_SOURCE_DIR}/..") # test_utils target_link_libraries(teststdgpu PRIVATE diff --git a/test/stdgpu/cuda/CMakeLists.txt b/test/stdgpu/cuda/CMakeLists.txt new file mode 100644 index 000000000..068fafca7 --- /dev/null +++ b/test/stdgpu/cuda/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(teststdgpu PRIVATE atomic.cu + bit.cu) From a22424bd5f0e4ee301224042db22df31ce269c30 Mon Sep 17 00:00:00 2001 From: Patrick Stotko Date: Mon, 28 Oct 2019 10:03:28 +0100 Subject: [PATCH 2/2] src: Move CUDA backend directory and use a separate CMake file for collecting its files --- doc/Doxyfile.in | 5 ++--- src/stdgpu/CMakeLists.txt | 8 ++++---- src/stdgpu/cuda/CMakeLists.txt | 5 +++++ src/stdgpu/{impl => }/cuda/atomic.cuh | 2 +- src/stdgpu/{impl => }/cuda/bit.cuh | 2 +- src/stdgpu/{impl/cuda => cuda/impl}/atomic_detail.cuh | 0 src/stdgpu/{impl/cuda => cuda/impl}/bit_detail.cuh | 0 src/stdgpu/{impl/cuda => cuda/impl}/memory.cpp | 2 +- src/stdgpu/{impl => }/cuda/memory.h | 0 src/stdgpu/impl/atomic_detail.cuh | 2 +- src/stdgpu/impl/bit_detail.h | 2 +- src/stdgpu/impl/memory.cpp | 2 +- 12 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 src/stdgpu/cuda/CMakeLists.txt rename src/stdgpu/{impl => }/cuda/atomic.cuh (99%) rename src/stdgpu/{impl => }/cuda/bit.cuh (97%) rename src/stdgpu/{impl/cuda => cuda/impl}/atomic_detail.cuh (100%) rename src/stdgpu/{impl/cuda => cuda/impl}/bit_detail.cuh (100%) rename src/stdgpu/{impl/cuda => cuda/impl}/memory.cpp (99%) rename src/stdgpu/{impl => }/cuda/memory.h (100%) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index b3b4f5c10..be09dc898 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -842,9 +842,8 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = */impl/*.cuh \ - */impl/*.h \ - */impl/*.hpp +EXCLUDE_PATTERNS = */impl/* \ + */cuda/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/src/stdgpu/CMakeLists.txt b/src/stdgpu/CMakeLists.txt index 02fa425a4..fcbbb404f 100644 --- a/src/stdgpu/CMakeLists.txt +++ b/src/stdgpu/CMakeLists.txt @@ -21,18 +21,18 @@ configure_file("${STDGPU_INCLUDE_LOCAL_DIR}/stdgpu/config.h.in" add_library(stdgpu STATIC) +add_subdirectory(cuda) + target_sources(stdgpu PRIVATE impl/bitset.cu impl/iterator.cpp impl/memory.cpp impl/mutex.cu - impl/limits.cpp - impl/cuda/memory.cpp) + impl/limits.cpp) target_include_directories(stdgpu PUBLIC $ $ - $ - ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) + $) add_library(stdgpu::stdgpu ALIAS stdgpu) diff --git a/src/stdgpu/cuda/CMakeLists.txt b/src/stdgpu/cuda/CMakeLists.txt new file mode 100644 index 000000000..9306d6472 --- /dev/null +++ b/src/stdgpu/cuda/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(stdgpu PRIVATE impl/memory.cpp) + +target_include_directories(stdgpu PUBLIC + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) diff --git a/src/stdgpu/impl/cuda/atomic.cuh b/src/stdgpu/cuda/atomic.cuh similarity index 99% rename from src/stdgpu/impl/cuda/atomic.cuh rename to src/stdgpu/cuda/atomic.cuh index 714be2437..84760b1ab 100644 --- a/src/stdgpu/impl/cuda/atomic.cuh +++ b/src/stdgpu/cuda/atomic.cuh @@ -189,7 +189,7 @@ atomicMax(float* address, -#include +#include diff --git a/src/stdgpu/impl/cuda/bit.cuh b/src/stdgpu/cuda/bit.cuh similarity index 97% rename from src/stdgpu/impl/cuda/bit.cuh rename to src/stdgpu/cuda/bit.cuh index 4475f3dba..5affa1b10 100644 --- a/src/stdgpu/impl/cuda/bit.cuh +++ b/src/stdgpu/cuda/bit.cuh @@ -66,7 +66,7 @@ popcount(const unsigned long long int number); -#include +#include #endif // STDGPU_CUDA_BIT_H diff --git a/src/stdgpu/impl/cuda/atomic_detail.cuh b/src/stdgpu/cuda/impl/atomic_detail.cuh similarity index 100% rename from src/stdgpu/impl/cuda/atomic_detail.cuh rename to src/stdgpu/cuda/impl/atomic_detail.cuh diff --git a/src/stdgpu/impl/cuda/bit_detail.cuh b/src/stdgpu/cuda/impl/bit_detail.cuh similarity index 100% rename from src/stdgpu/impl/cuda/bit_detail.cuh rename to src/stdgpu/cuda/impl/bit_detail.cuh diff --git a/src/stdgpu/impl/cuda/memory.cpp b/src/stdgpu/cuda/impl/memory.cpp similarity index 99% rename from src/stdgpu/impl/cuda/memory.cpp rename to src/stdgpu/cuda/impl/memory.cpp index 679b3fc3a..91a31d872 100644 --- a/src/stdgpu/impl/cuda/memory.cpp +++ b/src/stdgpu/cuda/impl/memory.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include #include #include diff --git a/src/stdgpu/impl/cuda/memory.h b/src/stdgpu/cuda/memory.h similarity index 100% rename from src/stdgpu/impl/cuda/memory.h rename to src/stdgpu/cuda/memory.h diff --git a/src/stdgpu/impl/atomic_detail.cuh b/src/stdgpu/impl/atomic_detail.cuh index aac4e3a64..b38c79e0d 100644 --- a/src/stdgpu/impl/atomic_detail.cuh +++ b/src/stdgpu/impl/atomic_detail.cuh @@ -16,7 +16,7 @@ #ifndef STDGPU_ATOMIC_DETAIL_H #define STDGPU_ATOMIC_DETAIL_H -#include +#include #include #include diff --git a/src/stdgpu/impl/bit_detail.h b/src/stdgpu/impl/bit_detail.h index 318151560..8db4fbbb1 100644 --- a/src/stdgpu/impl/bit_detail.h +++ b/src/stdgpu/impl/bit_detail.h @@ -17,7 +17,7 @@ #define STDGPU_BIT_DETAIL_H #if STDGPU_DEVICE_COMPILER == STDGPU_DEVICE_COMPILER_NVCC - #include + #include #endif #include #include diff --git a/src/stdgpu/impl/memory.cpp b/src/stdgpu/impl/memory.cpp index 448225f08..9804869d4 100644 --- a/src/stdgpu/impl/memory.cpp +++ b/src/stdgpu/impl/memory.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include