diff options
author | Brad King <brad.king@kitware.com> | 2017-12-15 15:35:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-12-15 15:35:17 (GMT) |
commit | 44111e5cc04ee689627acf5468d08e05c12b33aa (patch) | |
tree | 4d5247894c6ce0ba0027efff5282f29a49a55546 /Tests | |
parent | 4549eed94706d20ebbb1e8187f5b028c7bd4aa2e (diff) | |
parent | 8164298935cdd0970a4e86327184866496694b65 (diff) | |
download | CMake-44111e5cc04ee689627acf5468d08e05c12b33aa.zip CMake-44111e5cc04ee689627acf5468d08e05c12b33aa.tar.gz CMake-44111e5cc04ee689627acf5468d08e05c12b33aa.tar.bz2 |
Merge topic 'fix_failing_ResolveDeviceSymbols_test'
81642989 Cuda: ResolveDeviceSymbols now properly execute everywhere.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1593
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CudaOnly/ResolveDeviceSymbols/main.cu | 11 |
2 files changed, 10 insertions, 15 deletions
diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt index 8d6551b..83473ae 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt @@ -16,11 +16,11 @@ else() endif() #Goal for this example: -#Build a static library that defines multiple methods and kernels that -#use each other. -#Use a custom command to build an executable that uses this static library -#We do these together to verify that we can get a static library to do -#device symbol linking, and not have it done when the executable is made +# Build a static library that defines multiple methods and kernels that +# use each other. +# Resolve the device symbols into that static library +# Verify that we can't use those device symbols from anything that links +# to the static library string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) @@ -43,6 +43,10 @@ add_custom_command(TARGET CUDAResolveDeviceLib POST_BUILD endif() add_executable(CudaOnlyResolveDeviceSymbols main.cu) +set_target_properties(CudaOnlyResolveDeviceSymbols + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) + target_link_libraries(CudaOnlyResolveDeviceSymbols PRIVATE CUDAResolveDeviceLib) if(APPLE) diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/main.cu b/Tests/CudaOnly/ResolveDeviceSymbols/main.cu index b4b5b9e..d464f96 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/main.cu +++ b/Tests/CudaOnly/ResolveDeviceSymbols/main.cu @@ -62,17 +62,8 @@ int main(int argc, char** argv) return 0; } - cudaError_t err; - file2_launch_kernel(42); - err = cudaGetLastError(); - if (err != cudaSuccess) { - std::cerr << "file2_launch_kernel: kernel launch failed: " - << cudaGetErrorString(err) << std::endl; - return 1; - } - main_launch_kernel(1); - err = cudaGetLastError(); + cudaError_t err = cudaGetLastError(); if (err == cudaSuccess) { // This kernel launch should fail as the file2_func was device linked // into the static library and is not usable by the executable |