diff --git a/CHANGELOG.md b/CHANGELOG.md index 132af601..93d1500b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog +### CUDA 12.9 +* Updated toolchain for cross-compilation for Tegra Linux platforms. + ### CUDA 12.8 * Updated build system across the repository to CMake. Removed Visual Studio project files and Makefiles. * Removed the following outdated samples: diff --git a/CMakeLists.txt b/CMakeLists.txt index 105aadd2..f95e7aae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,10 @@ set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda") diff --git a/README.md b/README.md index 93ea15fa..9633b0f6 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,17 @@ Open the generated solution file CUDA_Samples.sln in Visual Studio. Build the sa Run the samples from the output directories specified in Visual Studio. +### Enabling On-GPU Debugging + +NVIDIA GPUs support on-GPU debugging through cuda-gdb. Enabling this may significantly affect application performance as certain compiler optimizations are disabled +in this configuration, hence it's not on by default. Enablement of on-device debugging is controlled via the `-G` switch to nvcc. + +To enable cuda-gdb for samples builds, define the `ENABLE_CUDA_DEBUG` flag on the CMake command line. For example: + +``` +cmake -DENABLE_CUDA_DEBUG=True ... +``` + ### Platform-Specific Samples Some CUDA samples are specific to certain platforms, and require passing flags into CMake to enable. In particular, we define the following platform-specific flags: @@ -94,9 +105,9 @@ Navigate to the root of the cloned repository and create a build directory: ``` mkdir build && cd build ``` -Configure the project with CMake, specifying the Tegra toolchain file: +Configure the project with CMake, specifying the Tegra toolchain file. And you can use -DTARGET_FS to point to the target file system root path for necessary include and library files: ``` -cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/tegra/toolchain.cmake +cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/toolchain-aarch64-linux.cmake -DTARGET_FS=/path/to/target/system/file/system ``` Build the samples: ``` diff --git a/Samples/0_Introduction/UnifiedMemoryStreams/CMakeLists.txt b/Samples/0_Introduction/UnifiedMemoryStreams/CMakeLists.txt index fa5ebb70..8dcaa0f0 100644 --- a/Samples/0_Introduction/UnifiedMemoryStreams/CMakeLists.txt +++ b/Samples/0_Introduction/UnifiedMemoryStreams/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/asyncAPI/CMakeLists.txt b/Samples/0_Introduction/asyncAPI/CMakeLists.txt index c68333ba..6fed8cf7 100644 --- a/Samples/0_Introduction/asyncAPI/CMakeLists.txt +++ b/Samples/0_Introduction/asyncAPI/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/clock/CMakeLists.txt b/Samples/0_Introduction/clock/CMakeLists.txt index 222d9277..740f03e9 100644 --- a/Samples/0_Introduction/clock/CMakeLists.txt +++ b/Samples/0_Introduction/clock/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/clock_nvrtc/CMakeLists.txt b/Samples/0_Introduction/clock_nvrtc/CMakeLists.txt index cf35861d..a9ad566f 100644 --- a/Samples/0_Introduction/clock_nvrtc/CMakeLists.txt +++ b/Samples/0_Introduction/clock_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/cudaOpenMP/CMakeLists.txt b/Samples/0_Introduction/cudaOpenMP/CMakeLists.txt index 74e871dd..886e0838 100644 --- a/Samples/0_Introduction/cudaOpenMP/CMakeLists.txt +++ b/Samples/0_Introduction/cudaOpenMP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/fp16ScalarProduct/CMakeLists.txt b/Samples/0_Introduction/fp16ScalarProduct/CMakeLists.txt index c1102962..4d265d49 100644 --- a/Samples/0_Introduction/fp16ScalarProduct/CMakeLists.txt +++ b/Samples/0_Introduction/fp16ScalarProduct/CMakeLists.txt @@ -9,8 +9,10 @@ find_package(CUDAToolkit REQUIRED) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/matrixMul/CMakeLists.txt b/Samples/0_Introduction/matrixMul/CMakeLists.txt index 6f5dd6c0..d0acc448 100644 --- a/Samples/0_Introduction/matrixMul/CMakeLists.txt +++ b/Samples/0_Introduction/matrixMul/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/matrixMulDrv/CMakeLists.txt b/Samples/0_Introduction/matrixMulDrv/CMakeLists.txt index 47296bee..85cad9d3 100644 --- a/Samples/0_Introduction/matrixMulDrv/CMakeLists.txt +++ b/Samples/0_Introduction/matrixMulDrv/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -38,6 +40,12 @@ target_link_libraries(matrixMulDrv PUBLIC set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/matrixMul_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/matrixMul_kernel.cu") +# Construct GENCODE_FLAGS explicitly from CUDA architectures +set(GENCODE_FLAGS "") +foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") +endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt b/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt index 8c6a3a36..6e4f044c 100644 --- a/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt +++ b/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt b/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt index 4b2fcdb0..91148968 100644 --- a/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt +++ b/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/mergeSort/CMakeLists.txt b/Samples/0_Introduction/mergeSort/CMakeLists.txt index 8d03adc0..82583db8 100644 --- a/Samples/0_Introduction/mergeSort/CMakeLists.txt +++ b/Samples/0_Introduction/mergeSort/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleAWBarrier/CMakeLists.txt b/Samples/0_Introduction/simpleAWBarrier/CMakeLists.txt index 27bc297f..b87c63d0 100644 --- a/Samples/0_Introduction/simpleAWBarrier/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAWBarrier/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleAssert/CMakeLists.txt b/Samples/0_Introduction/simpleAssert/CMakeLists.txt index 2479c900..cf5e3729 100644 --- a/Samples/0_Introduction/simpleAssert/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAssert/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Removes -DNDEBUG For Print specific logs in this sample. diff --git a/Samples/0_Introduction/simpleAssert_nvrtc/CMakeLists.txt b/Samples/0_Introduction/simpleAssert_nvrtc/CMakeLists.txt index f2e6c4e1..7953acbe 100644 --- a/Samples/0_Introduction/simpleAssert_nvrtc/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAssert_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleAtomicIntrinsics/CMakeLists.txt b/Samples/0_Introduction/simpleAtomicIntrinsics/CMakeLists.txt index 7903216f..594aeb1e 100644 --- a/Samples/0_Introduction/simpleAtomicIntrinsics/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAtomicIntrinsics/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleAtomicIntrinsics_nvrtc/CMakeLists.txt b/Samples/0_Introduction/simpleAtomicIntrinsics_nvrtc/CMakeLists.txt index f09eb8d2..0eae7168 100644 --- a/Samples/0_Introduction/simpleAtomicIntrinsics_nvrtc/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAtomicIntrinsics_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleAttributes/CMakeLists.txt b/Samples/0_Introduction/simpleAttributes/CMakeLists.txt index 32ac2844..92d61f7e 100644 --- a/Samples/0_Introduction/simpleAttributes/CMakeLists.txt +++ b/Samples/0_Introduction/simpleAttributes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleCUDA2GL/CMakeLists.txt b/Samples/0_Introduction/simpleCUDA2GL/CMakeLists.txt index 9dac9ee2..fef94f01 100644 --- a/Samples/0_Introduction/simpleCUDA2GL/CMakeLists.txt +++ b/Samples/0_Introduction/simpleCUDA2GL/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleCallback/CMakeLists.txt b/Samples/0_Introduction/simpleCallback/CMakeLists.txt index 9aaada04..34b22185 100644 --- a/Samples/0_Introduction/simpleCallback/CMakeLists.txt +++ b/Samples/0_Introduction/simpleCallback/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleCooperativeGroups/CMakeLists.txt b/Samples/0_Introduction/simpleCooperativeGroups/CMakeLists.txt index 40dfd135..38729258 100644 --- a/Samples/0_Introduction/simpleCooperativeGroups/CMakeLists.txt +++ b/Samples/0_Introduction/simpleCooperativeGroups/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleCubemapTexture/CMakeLists.txt b/Samples/0_Introduction/simpleCubemapTexture/CMakeLists.txt index 6318e0f5..ea696b01 100644 --- a/Samples/0_Introduction/simpleCubemapTexture/CMakeLists.txt +++ b/Samples/0_Introduction/simpleCubemapTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleDrvRuntime/CMakeLists.txt b/Samples/0_Introduction/simpleDrvRuntime/CMakeLists.txt index 84672fa8..197de448 100644 --- a/Samples/0_Introduction/simpleDrvRuntime/CMakeLists.txt +++ b/Samples/0_Introduction/simpleDrvRuntime/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -40,6 +42,12 @@ target_link_libraries(simpleDrvRuntime PUBLIC set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/vectorAdd_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/vectorAdd_kernel.cu") +# Construct GENCODE_FLAGS explicitly from CUDA architectures +set(GENCODE_FLAGS "") +foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") +endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/0_Introduction/simpleHyperQ/CMakeLists.txt b/Samples/0_Introduction/simpleHyperQ/CMakeLists.txt index cccf5e8e..be63170f 100644 --- a/Samples/0_Introduction/simpleHyperQ/CMakeLists.txt +++ b/Samples/0_Introduction/simpleHyperQ/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleIPC/CMakeLists.txt b/Samples/0_Introduction/simpleIPC/CMakeLists.txt index 0676267c..fdf21f87 100644 --- a/Samples/0_Introduction/simpleIPC/CMakeLists.txt +++ b/Samples/0_Introduction/simpleIPC/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleLayeredTexture/CMakeLists.txt b/Samples/0_Introduction/simpleLayeredTexture/CMakeLists.txt index a3565779..bae6dd8d 100644 --- a/Samples/0_Introduction/simpleLayeredTexture/CMakeLists.txt +++ b/Samples/0_Introduction/simpleLayeredTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleMPI/CMakeLists.txt b/Samples/0_Introduction/simpleMPI/CMakeLists.txt index 70e1e429..15466d28 100644 --- a/Samples/0_Introduction/simpleMPI/CMakeLists.txt +++ b/Samples/0_Introduction/simpleMPI/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleMultiCopy/CMakeLists.txt b/Samples/0_Introduction/simpleMultiCopy/CMakeLists.txt index 5832e2f7..f48c6e03 100644 --- a/Samples/0_Introduction/simpleMultiCopy/CMakeLists.txt +++ b/Samples/0_Introduction/simpleMultiCopy/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleMultiGPU/CMakeLists.txt b/Samples/0_Introduction/simpleMultiGPU/CMakeLists.txt index 408f7d06..ac73641c 100644 --- a/Samples/0_Introduction/simpleMultiGPU/CMakeLists.txt +++ b/Samples/0_Introduction/simpleMultiGPU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleOccupancy/CMakeLists.txt b/Samples/0_Introduction/simpleOccupancy/CMakeLists.txt index 2b6cdc63..6859a157 100644 --- a/Samples/0_Introduction/simpleOccupancy/CMakeLists.txt +++ b/Samples/0_Introduction/simpleOccupancy/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleP2P/CMakeLists.txt b/Samples/0_Introduction/simpleP2P/CMakeLists.txt index 8a1cc242..f0b82c6e 100644 --- a/Samples/0_Introduction/simpleP2P/CMakeLists.txt +++ b/Samples/0_Introduction/simpleP2P/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simplePitchLinearTexture/CMakeLists.txt b/Samples/0_Introduction/simplePitchLinearTexture/CMakeLists.txt index 7c613e59..6d431f62 100644 --- a/Samples/0_Introduction/simplePitchLinearTexture/CMakeLists.txt +++ b/Samples/0_Introduction/simplePitchLinearTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simplePrintf/CMakeLists.txt b/Samples/0_Introduction/simplePrintf/CMakeLists.txt index 444c4305..f3ec60b8 100644 --- a/Samples/0_Introduction/simplePrintf/CMakeLists.txt +++ b/Samples/0_Introduction/simplePrintf/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleStreams/CMakeLists.txt b/Samples/0_Introduction/simpleStreams/CMakeLists.txt index 58744561..dce86206 100644 --- a/Samples/0_Introduction/simpleStreams/CMakeLists.txt +++ b/Samples/0_Introduction/simpleStreams/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleSurfaceWrite/CMakeLists.txt b/Samples/0_Introduction/simpleSurfaceWrite/CMakeLists.txt index 3aff648e..5c65251e 100644 --- a/Samples/0_Introduction/simpleSurfaceWrite/CMakeLists.txt +++ b/Samples/0_Introduction/simpleSurfaceWrite/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleTemplates/CMakeLists.txt b/Samples/0_Introduction/simpleTemplates/CMakeLists.txt index 0e69bdde..a821e7bb 100644 --- a/Samples/0_Introduction/simpleTemplates/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTemplates/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleTexture/CMakeLists.txt b/Samples/0_Introduction/simpleTexture/CMakeLists.txt index 6d704c1c..688116ba 100644 --- a/Samples/0_Introduction/simpleTexture/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleTexture3D/CMakeLists.txt b/Samples/0_Introduction/simpleTexture3D/CMakeLists.txt index 56d0fdb1..1917544b 100644 --- a/Samples/0_Introduction/simpleTexture3D/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTexture3D/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt b/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt index 58ecb88a..ed501b38 100644 --- a/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -37,6 +39,12 @@ target_link_libraries(simpleTextureDrv PUBLIC set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/simpleTexture_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/simpleTexture_kernel.cu") +# Construct GENCODE_FLAGS explicitly from CUDA architectures +set(GENCODE_FLAGS "") +foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") +endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/0_Introduction/simpleVoteIntrinsics/CMakeLists.txt b/Samples/0_Introduction/simpleVoteIntrinsics/CMakeLists.txt index b1759c94..1b151bcf 100644 --- a/Samples/0_Introduction/simpleVoteIntrinsics/CMakeLists.txt +++ b/Samples/0_Introduction/simpleVoteIntrinsics/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/simpleZeroCopy/CMakeLists.txt b/Samples/0_Introduction/simpleZeroCopy/CMakeLists.txt index 032cf051..1e93e05a 100644 --- a/Samples/0_Introduction/simpleZeroCopy/CMakeLists.txt +++ b/Samples/0_Introduction/simpleZeroCopy/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/systemWideAtomics/CMakeLists.txt b/Samples/0_Introduction/systemWideAtomics/CMakeLists.txt index c87ec45b..3e50470c 100644 --- a/Samples/0_Introduction/systemWideAtomics/CMakeLists.txt +++ b/Samples/0_Introduction/systemWideAtomics/CMakeLists.txt @@ -9,8 +9,10 @@ find_package(CUDAToolkit REQUIRED) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/template/CMakeLists.txt b/Samples/0_Introduction/template/CMakeLists.txt index c1d32440..4aa8c0dd 100644 --- a/Samples/0_Introduction/template/CMakeLists.txt +++ b/Samples/0_Introduction/template/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() diff --git a/Samples/0_Introduction/vectorAdd/CMakeLists.txt b/Samples/0_Introduction/vectorAdd/CMakeLists.txt index 9a075bb3..4c6ef8cd 100644 --- a/Samples/0_Introduction/vectorAdd/CMakeLists.txt +++ b/Samples/0_Introduction/vectorAdd/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/0_Introduction/vectorAddDrv/CMakeLists.txt b/Samples/0_Introduction/vectorAddDrv/CMakeLists.txt index 8517dc1c..bf4b8255 100644 --- a/Samples/0_Introduction/vectorAddDrv/CMakeLists.txt +++ b/Samples/0_Introduction/vectorAddDrv/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -37,6 +39,12 @@ target_link_libraries(vectorAddDrv PUBLIC set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/vectorAdd_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/vectorAdd_kernel.cu") +# Construct GENCODE_FLAGS explicitly from CUDA architectures +set(GENCODE_FLAGS "") +foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") +endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/0_Introduction/vectorAddMMAP/CMakeLists.txt b/Samples/0_Introduction/vectorAddMMAP/CMakeLists.txt index e52fdfce..73cbeca8 100644 --- a/Samples/0_Introduction/vectorAddMMAP/CMakeLists.txt +++ b/Samples/0_Introduction/vectorAddMMAP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -40,6 +42,12 @@ else() set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/vectorAdd_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/vectorAdd_kernel.cu") + # Construct GENCODE_FLAGS explicitly from CUDA architectures + set(GENCODE_FLAGS "") + foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") + endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/0_Introduction/vectorAdd_nvrtc/CMakeLists.txt b/Samples/0_Introduction/vectorAdd_nvrtc/CMakeLists.txt index d829846a..331d275b 100644 --- a/Samples/0_Introduction/vectorAdd_nvrtc/CMakeLists.txt +++ b/Samples/0_Introduction/vectorAdd_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/1_Utilities/bandwidthTest/CMakeLists.txt b/Samples/1_Utilities/bandwidthTest/CMakeLists.txt index 04375e50..32c3bff1 100644 --- a/Samples/1_Utilities/bandwidthTest/CMakeLists.txt +++ b/Samples/1_Utilities/bandwidthTest/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/1_Utilities/deviceQuery/CMakeLists.txt b/Samples/1_Utilities/deviceQuery/CMakeLists.txt index 64757acc..4b308e9c 100644 --- a/Samples/1_Utilities/deviceQuery/CMakeLists.txt +++ b/Samples/1_Utilities/deviceQuery/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/1_Utilities/deviceQueryDrv/CMakeLists.txt b/Samples/1_Utilities/deviceQueryDrv/CMakeLists.txt index 392bd481..1422633a 100644 --- a/Samples/1_Utilities/deviceQueryDrv/CMakeLists.txt +++ b/Samples/1_Utilities/deviceQueryDrv/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/1_Utilities/topologyQuery/CMakeLists.txt b/Samples/1_Utilities/topologyQuery/CMakeLists.txt index e9e5de71..f5489592 100644 --- a/Samples/1_Utilities/topologyQuery/CMakeLists.txt +++ b/Samples/1_Utilities/topologyQuery/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_CrossGPU/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_CrossGPU/CMakeLists.txt index 283c3878..d07e7e06 100644 --- a/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_CrossGPU/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_CrossGPU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_Interop/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_Interop/CMakeLists.txt index 0c3b8238..44d3ece4 100644 --- a/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_Interop/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/EGLStream_CUDA_Interop/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/FunctionPointers/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/FunctionPointers/CMakeLists.txt index f14246d3..56431c39 100644 --- a/Samples/2_Concepts_and_Techniques/FunctionPointers/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/FunctionPointers/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineP/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineP/CMakeLists.txt index 0e473c35..f13f993b 100644 --- a/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineP/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineQ/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineQ/CMakeLists.txt index 52129295..f3738b73 100644 --- a/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineQ/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/MC_EstimatePiInlineQ/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/MC_EstimatePiP/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/MC_EstimatePiP/CMakeLists.txt index 5f4ed1c4..4a616160 100644 --- a/Samples/2_Concepts_and_Techniques/MC_EstimatePiP/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/MC_EstimatePiP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/MC_EstimatePiQ/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/MC_EstimatePiQ/CMakeLists.txt index 458335d4..2ac32b13 100644 --- a/Samples/2_Concepts_and_Techniques/MC_EstimatePiQ/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/MC_EstimatePiQ/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/MC_SingleAsianOptionP/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/MC_SingleAsianOptionP/CMakeLists.txt index 4f2ed5e7..991b3f05 100644 --- a/Samples/2_Concepts_and_Techniques/MC_SingleAsianOptionP/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/MC_SingleAsianOptionP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt index 13c34989..a6420e95 100644 --- a/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -77,7 +79,7 @@ if(${OpenGL_FOUND}) add_custom_command(TARGET boxFilter POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}/$ ) diff --git a/Samples/2_Concepts_and_Techniques/convolutionSeparable/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/convolutionSeparable/CMakeLists.txt index 797f8a3f..6d5face7 100644 --- a/Samples/2_Concepts_and_Techniques/convolutionSeparable/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/convolutionSeparable/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/convolutionTexture/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/convolutionTexture/CMakeLists.txt index 578457a8..b5cf2494 100644 --- a/Samples/2_Concepts_and_Techniques/convolutionTexture/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/convolutionTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt index 2a831059..2044da7d 100644 --- a/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt index 77473fa2..b4f8b900 100644 --- a/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/histogram/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/histogram/CMakeLists.txt index 020920d2..293dff7c 100644 --- a/Samples/2_Concepts_and_Techniques/histogram/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/histogram/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/imageDenoising/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/imageDenoising/CMakeLists.txt index 8239281c..63923d77 100644 --- a/Samples/2_Concepts_and_Techniques/imageDenoising/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/imageDenoising/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/inlinePTX/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/inlinePTX/CMakeLists.txt index 1e07d783..65342964 100644 --- a/Samples/2_Concepts_and_Techniques/inlinePTX/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/inlinePTX/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/inlinePTX_nvrtc/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/inlinePTX_nvrtc/CMakeLists.txt index 5f506760..5434fcf0 100644 --- a/Samples/2_Concepts_and_Techniques/inlinePTX_nvrtc/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/inlinePTX_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/interval/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/interval/CMakeLists.txt index 483e61ce..59715f12 100644 --- a/Samples/2_Concepts_and_Techniques/interval/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/interval/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt index 12ee370b..6afbfe4a 100644 --- a/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/radixSortThrust/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/radixSortThrust/CMakeLists.txt index db620c69..e5a68b2e 100644 --- a/Samples/2_Concepts_and_Techniques/radixSortThrust/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/radixSortThrust/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/reduction/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/reduction/CMakeLists.txt index d2a2d3d0..597bfe20 100644 --- a/Samples/2_Concepts_and_Techniques/reduction/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/reduction/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/reductionMultiBlockCG/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/reductionMultiBlockCG/CMakeLists.txt index 5f2f1b33..e8195680 100644 --- a/Samples/2_Concepts_and_Techniques/reductionMultiBlockCG/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/reductionMultiBlockCG/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/scalarProd/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/scalarProd/CMakeLists.txt index 301b8d9a..e641f84d 100644 --- a/Samples/2_Concepts_and_Techniques/scalarProd/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/scalarProd/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/scan/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/scan/CMakeLists.txt index 1bf1945c..61b70d9b 100644 --- a/Samples/2_Concepts_and_Techniques/scan/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/scan/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt index bfc32c75..5c210e3d 100644 --- a/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/shfl_scan/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/shfl_scan/CMakeLists.txt index b7fab3f2..ad697e60 100644 --- a/Samples/2_Concepts_and_Techniques/shfl_scan/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/shfl_scan/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/sortingNetworks/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/sortingNetworks/CMakeLists.txt index e4dd7de8..fd183a8a 100644 --- a/Samples/2_Concepts_and_Techniques/sortingNetworks/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/sortingNetworks/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/streamOrderedAllocation/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/streamOrderedAllocation/CMakeLists.txt index e7bcb444..ecfd0087 100644 --- a/Samples/2_Concepts_and_Techniques/streamOrderedAllocation/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/streamOrderedAllocation/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/CMakeLists.txt index 96ebee00..67d30909 100644 --- a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu index 51c9dcd8..d9c5e38d 100644 --- a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu +++ b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu @@ -59,6 +59,7 @@ typedef struct shmStruct_st { size_t nprocesses; int barrier; int sense; + cudaMemAllocationHandleType handleType; int devices[MAX_DEVICES]; cudaMemPoolPtrExportData exportPtrData[MAX_DEVICES]; } shmStruct; @@ -126,7 +127,7 @@ static void childProcess(int id) { std::vector pools(shm->nprocesses); - cudaMemAllocationHandleType handleType = cudaMemHandleTypePosixFileDescriptor; + cudaMemAllocationHandleType handleType = shm->handleType; // Import mem pools from all the devices created in the master // process using shareable handles received via socket @@ -239,6 +240,7 @@ static void parentProcess(char *app) { volatile shmStruct *shm = NULL; std::vector ptrs; std::vector processes; + cudaMemAllocationHandleType handleType = cudaMemHandleTypeNone; checkCudaErrors(cudaGetDeviceCount(&devCount)); std::vector devices(devCount); @@ -270,22 +272,32 @@ static void parentProcess(char *app) { printf("Device %d does not support cuda memory pools, skipping...\n", i); continue; } - int deviceSupportsIpcHandle = 0; -#if defined(__linux__) - checkCudaErrors(cuDeviceGetAttribute( - &deviceSupportsIpcHandle, - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED, - devices[i])); -#else - cuDeviceGetAttribute(&deviceSupportsIpcHandle, - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED, - devices[i]); -#endif - - if (!deviceSupportsIpcHandle) { - printf("Device %d does not support CUDA IPC Handle, skipping...\n", i); + int supportedHandleTypes = 0; + checkCudaErrors(cudaDeviceGetAttribute(&supportedHandleTypes, + cudaDevAttrMemoryPoolSupportedHandleTypes, i)); + if (supportedHandleTypes == 0) { + printf("Device %d does not support Memory pool based IPC, skipping...\n", i); continue; } + + if (handleType == cudaMemHandleTypeNone) { + if (supportedHandleTypes & cudaMemHandleTypePosixFileDescriptor) { + handleType = cudaMemHandleTypePosixFileDescriptor; + } + else if (supportedHandleTypes & cudaMemHandleTypeWin32) { + handleType = cudaMemHandleTypeWin32; + } + else { + printf("Device %d does not support any supported handle types, skipping...\n", i); + continue; + } + } + else { + if ((supportedHandleTypes & handleType) != handleType) { + printf("Mixed handle types are not supported, waiving test\n"); + exit(EXIT_WAIVED); + } + } // This sample requires two processes accessing each device, so we need // to ensure exclusive or prohibited mode is not set if (prop.computeMode != cudaComputeModeDefault) { @@ -337,6 +349,11 @@ static void parentProcess(char *app) { exit(EXIT_WAIVED); } + if (handleType == cudaMemHandleTypeNone) { + printf("No supported handle types found, waiving test\n"); + exit(EXIT_WAIVED); + } + std::vector shareableHandles(shm->nprocesses); std::vector streams(shm->nprocesses); std::vector pools(shm->nprocesses); @@ -352,7 +369,7 @@ static void parentProcess(char *app) { cudaMemPoolProps poolProps; memset(&poolProps, 0, sizeof(cudaMemPoolProps)); poolProps.allocType = cudaMemAllocationTypePinned; - poolProps.handleTypes = cudaMemHandleTypePosixFileDescriptor; + poolProps.handleTypes = handleType; poolProps.location.type = cudaMemLocationTypeDevice; poolProps.location.id = shm->devices[i]; @@ -360,8 +377,6 @@ static void parentProcess(char *app) { checkCudaErrors(cudaMemPoolCreate(&pools[i], &poolProps)); // Query the shareable handle for the pool - cudaMemAllocationHandleType handleType = - cudaMemHandleTypePosixFileDescriptor; // Allocate memory in a stream from the pool just created checkCudaErrors(cudaMallocAsync(&ptr, DATA_SIZE, pools[i], streams[i])); @@ -378,6 +393,8 @@ static void parentProcess(char *app) { ptrs.push_back(ptr); } + shm->handleType = handleType; + // Launch the child processes! for (i = 0; i < shm->nprocesses; i++) { char devIdx[10]; @@ -430,7 +447,7 @@ static void parentProcess(char *app) { int main(int argc, char **argv) { #if defined(__arm__) || defined(__aarch64__) || defined(WIN32) || \ defined(_WIN32) || defined(WIN64) || defined(_WIN64) - printf("Not supported on ARM\n"); + printf("Not supported on ARM or Windows\n"); return EXIT_WAIVED; #else if (argc == 1) { diff --git a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationP2P/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationP2P/CMakeLists.txt index 8cb8493e..2c265c58 100644 --- a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationP2P/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationP2P/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/threadFenceReduction/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/threadFenceReduction/CMakeLists.txt index 4de33d50..cee0fea2 100644 --- a/Samples/2_Concepts_and_Techniques/threadFenceReduction/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/threadFenceReduction/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/2_Concepts_and_Techniques/threadMigration/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/threadMigration/CMakeLists.txt index 6459bc3c..d88458e7 100644 --- a/Samples/2_Concepts_and_Techniques/threadMigration/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/threadMigration/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -42,6 +44,12 @@ endif() set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/threadMigration_kernel64.fatbin") set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/threadMigration_kernel.cu") +# Construct GENCODE_FLAGS explicitly from CUDA architectures +set(GENCODE_FLAGS "") +foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") +endforeach() + add_custom_command( OUTPUT ${CUDA_FATBIN_FILE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} diff --git a/Samples/3_CUDA_Features/StreamPriorities/CMakeLists.txt b/Samples/3_CUDA_Features/StreamPriorities/CMakeLists.txt index 4048e9da..561a2f47 100644 --- a/Samples/3_CUDA_Features/StreamPriorities/CMakeLists.txt +++ b/Samples/3_CUDA_Features/StreamPriorities/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/bf16TensorCoreGemm/CMakeLists.txt b/Samples/3_CUDA_Features/bf16TensorCoreGemm/CMakeLists.txt index fc9fe751..76245f2d 100644 --- a/Samples/3_CUDA_Features/bf16TensorCoreGemm/CMakeLists.txt +++ b/Samples/3_CUDA_Features/bf16TensorCoreGemm/CMakeLists.txt @@ -9,8 +9,10 @@ find_package(CUDAToolkit REQUIRED) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/binaryPartitionCG/CMakeLists.txt b/Samples/3_CUDA_Features/binaryPartitionCG/CMakeLists.txt index 0a50964d..61f471ca 100644 --- a/Samples/3_CUDA_Features/binaryPartitionCG/CMakeLists.txt +++ b/Samples/3_CUDA_Features/binaryPartitionCG/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/bindlessTexture/CMakeLists.txt b/Samples/3_CUDA_Features/bindlessTexture/CMakeLists.txt index 93ada969..90751dff 100644 --- a/Samples/3_CUDA_Features/bindlessTexture/CMakeLists.txt +++ b/Samples/3_CUDA_Features/bindlessTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cdpAdvancedQuicksort/CMakeLists.txt b/Samples/3_CUDA_Features/cdpAdvancedQuicksort/CMakeLists.txt index 0a178ff1..597ac752 100644 --- a/Samples/3_CUDA_Features/cdpAdvancedQuicksort/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cdpAdvancedQuicksort/CMakeLists.txt @@ -21,8 +21,10 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cdpBezierTessellation/CMakeLists.txt b/Samples/3_CUDA_Features/cdpBezierTessellation/CMakeLists.txt index 1bbba649..b2bcb8a7 100644 --- a/Samples/3_CUDA_Features/cdpBezierTessellation/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cdpBezierTessellation/CMakeLists.txt @@ -21,8 +21,10 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cdpQuadtree/CMakeLists.txt b/Samples/3_CUDA_Features/cdpQuadtree/CMakeLists.txt index 0b881038..f262d70c 100644 --- a/Samples/3_CUDA_Features/cdpQuadtree/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cdpQuadtree/CMakeLists.txt @@ -21,8 +21,10 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cdpSimplePrint/CMakeLists.txt b/Samples/3_CUDA_Features/cdpSimplePrint/CMakeLists.txt index 113cb94b..3732bf29 100644 --- a/Samples/3_CUDA_Features/cdpSimplePrint/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cdpSimplePrint/CMakeLists.txt @@ -21,8 +21,10 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cdpSimpleQuicksort/CMakeLists.txt b/Samples/3_CUDA_Features/cdpSimpleQuicksort/CMakeLists.txt index 918d0e89..f616cd02 100644 --- a/Samples/3_CUDA_Features/cdpSimpleQuicksort/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cdpSimpleQuicksort/CMakeLists.txt @@ -21,8 +21,10 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cudaCompressibleMemory/CMakeLists.txt b/Samples/3_CUDA_Features/cudaCompressibleMemory/CMakeLists.txt index f6bf6ffd..7313becf 100644 --- a/Samples/3_CUDA_Features/cudaCompressibleMemory/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cudaCompressibleMemory/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/cudaTensorCoreGemm/CMakeLists.txt b/Samples/3_CUDA_Features/cudaTensorCoreGemm/CMakeLists.txt index b0eeed50..f6bf81e3 100644 --- a/Samples/3_CUDA_Features/cudaTensorCoreGemm/CMakeLists.txt +++ b/Samples/3_CUDA_Features/cudaTensorCoreGemm/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/dmmaTensorCoreGemm/CMakeLists.txt b/Samples/3_CUDA_Features/dmmaTensorCoreGemm/CMakeLists.txt index a7ed0464..ba7d2364 100644 --- a/Samples/3_CUDA_Features/dmmaTensorCoreGemm/CMakeLists.txt +++ b/Samples/3_CUDA_Features/dmmaTensorCoreGemm/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/globalToShmemAsyncCopy/CMakeLists.txt b/Samples/3_CUDA_Features/globalToShmemAsyncCopy/CMakeLists.txt index fb9ad2b4..8f953d0d 100644 --- a/Samples/3_CUDA_Features/globalToShmemAsyncCopy/CMakeLists.txt +++ b/Samples/3_CUDA_Features/globalToShmemAsyncCopy/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/graphConditionalNodes/CMakeLists.txt b/Samples/3_CUDA_Features/graphConditionalNodes/CMakeLists.txt index 98e07ae2..9b623c4e 100644 --- a/Samples/3_CUDA_Features/graphConditionalNodes/CMakeLists.txt +++ b/Samples/3_CUDA_Features/graphConditionalNodes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/graphMemoryFootprint/CMakeLists.txt b/Samples/3_CUDA_Features/graphMemoryFootprint/CMakeLists.txt index e0a81184..8873b594 100644 --- a/Samples/3_CUDA_Features/graphMemoryFootprint/CMakeLists.txt +++ b/Samples/3_CUDA_Features/graphMemoryFootprint/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/graphMemoryNodes/CMakeLists.txt b/Samples/3_CUDA_Features/graphMemoryNodes/CMakeLists.txt index 449c6273..30040614 100644 --- a/Samples/3_CUDA_Features/graphMemoryNodes/CMakeLists.txt +++ b/Samples/3_CUDA_Features/graphMemoryNodes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/immaTensorCoreGemm/CMakeLists.txt b/Samples/3_CUDA_Features/immaTensorCoreGemm/CMakeLists.txt index 71b20f45..dce21aa8 100644 --- a/Samples/3_CUDA_Features/immaTensorCoreGemm/CMakeLists.txt +++ b/Samples/3_CUDA_Features/immaTensorCoreGemm/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/jacobiCudaGraphs/CMakeLists.txt b/Samples/3_CUDA_Features/jacobiCudaGraphs/CMakeLists.txt index 240d91ad..0ed1f98b 100644 --- a/Samples/3_CUDA_Features/jacobiCudaGraphs/CMakeLists.txt +++ b/Samples/3_CUDA_Features/jacobiCudaGraphs/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/memMapIPCDrv/CMakeLists.txt b/Samples/3_CUDA_Features/memMapIPCDrv/CMakeLists.txt index b3ae7989..c3a04081 100644 --- a/Samples/3_CUDA_Features/memMapIPCDrv/CMakeLists.txt +++ b/Samples/3_CUDA_Features/memMapIPCDrv/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -44,7 +46,7 @@ set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/memMapIpc_kernel.cu") add_custom_command( OUTPUT ${CUDA_PTX_FILE} - COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_PTX_FILE} -ptx ${CUDA_KERNEL_SOURCE} + COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets -o ${CUDA_PTX_FILE} -ptx ${CUDA_KERNEL_SOURCE} DEPENDS ${CUDA_KERNEL_SOURCE} COMMENT "Building CUDA PTX: ${CUDA_PTX_FILE}" ) diff --git a/Samples/3_CUDA_Features/newdelete/CMakeLists.txt b/Samples/3_CUDA_Features/newdelete/CMakeLists.txt index 5869b9e8..b293fe4a 100644 --- a/Samples/3_CUDA_Features/newdelete/CMakeLists.txt +++ b/Samples/3_CUDA_Features/newdelete/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/ptxjit/CMakeLists.txt b/Samples/3_CUDA_Features/ptxjit/CMakeLists.txt index 059dd86f..d1c27fb9 100644 --- a/Samples/3_CUDA_Features/ptxjit/CMakeLists.txt +++ b/Samples/3_CUDA_Features/ptxjit/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -41,7 +43,7 @@ set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ptxjit_kernel.cu") add_custom_command( OUTPUT ${CUDA_PTX_FILE} - COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_PTX_FILE} -ptx ${CUDA_KERNEL_SOURCE} + COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets -o ${CUDA_PTX_FILE} -ptx ${CUDA_KERNEL_SOURCE} DEPENDS ${CUDA_KERNEL_SOURCE} COMMENT "Building CUDA PTX: ${CUDA_PTX_FILE}" ) diff --git a/Samples/3_CUDA_Features/simpleCudaGraphs/CMakeLists.txt b/Samples/3_CUDA_Features/simpleCudaGraphs/CMakeLists.txt index f4e1887c..13635969 100644 --- a/Samples/3_CUDA_Features/simpleCudaGraphs/CMakeLists.txt +++ b/Samples/3_CUDA_Features/simpleCudaGraphs/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/tf32TensorCoreGemm/CMakeLists.txt b/Samples/3_CUDA_Features/tf32TensorCoreGemm/CMakeLists.txt index 0f59ce1c..3b793770 100644 --- a/Samples/3_CUDA_Features/tf32TensorCoreGemm/CMakeLists.txt +++ b/Samples/3_CUDA_Features/tf32TensorCoreGemm/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/3_CUDA_Features/warpAggregatedAtomicsCG/CMakeLists.txt b/Samples/3_CUDA_Features/warpAggregatedAtomicsCG/CMakeLists.txt index 2841b1bc..1cfb090e 100644 --- a/Samples/3_CUDA_Features/warpAggregatedAtomicsCG/CMakeLists.txt +++ b/Samples/3_CUDA_Features/warpAggregatedAtomicsCG/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/FilterBorderControlNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/FilterBorderControlNPP/CMakeLists.txt index 6641de51..ba7bd2f3 100644 --- a/Samples/4_CUDA_Libraries/FilterBorderControlNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/FilterBorderControlNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/MersenneTwisterGP11213/CMakeLists.txt b/Samples/4_CUDA_Libraries/MersenneTwisterGP11213/CMakeLists.txt index 7980efc8..f0fd8045 100644 --- a/Samples/4_CUDA_Libraries/MersenneTwisterGP11213/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/MersenneTwisterGP11213/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/batchCUBLAS/CMakeLists.txt b/Samples/4_CUDA_Libraries/batchCUBLAS/CMakeLists.txt index bb876d57..bc4e9c46 100644 --- a/Samples/4_CUDA_Libraries/batchCUBLAS/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/batchCUBLAS/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/boxFilterNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/boxFilterNPP/CMakeLists.txt index 0c5f15e0..5fd6ef98 100644 --- a/Samples/4_CUDA_Libraries/boxFilterNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/boxFilterNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cannyEdgeDetectorNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/cannyEdgeDetectorNPP/CMakeLists.txt index 7e22bac9..eb309ad4 100644 --- a/Samples/4_CUDA_Libraries/cannyEdgeDetectorNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cannyEdgeDetectorNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradient/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradient/CMakeLists.txt index 29f7f65f..65b0ff35 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradient/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradient/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradientCudaGraphs/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradientCudaGraphs/CMakeLists.txt index dd587ad3..20c1783a 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradientCudaGraphs/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradientCudaGraphs/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradientMultiBlockCG/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradientMultiBlockCG/CMakeLists.txt index 2bfe6f0e..6bbdd09a 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradientMultiBlockCG/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradientMultiBlockCG/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradientMultiDeviceCG/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradientMultiDeviceCG/CMakeLists.txt index c7381cba..775ee452 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradientMultiDeviceCG/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradientMultiDeviceCG/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradientPrecond/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradientPrecond/CMakeLists.txt index 92cbcae7..455dd818 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradientPrecond/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradientPrecond/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/conjugateGradientUM/CMakeLists.txt b/Samples/4_CUDA_Libraries/conjugateGradientUM/CMakeLists.txt index b98c6e5a..492b4f24 100644 --- a/Samples/4_CUDA_Libraries/conjugateGradientUM/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/conjugateGradientUM/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cuSolverDn_LinearSolver/CMakeLists.txt b/Samples/4_CUDA_Libraries/cuSolverDn_LinearSolver/CMakeLists.txt index 8e54cac2..8865f7ef 100644 --- a/Samples/4_CUDA_Libraries/cuSolverDn_LinearSolver/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cuSolverDn_LinearSolver/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cuSolverRf/CMakeLists.txt b/Samples/4_CUDA_Libraries/cuSolverRf/CMakeLists.txt index 9e8a4b16..20f57fd6 100644 --- a/Samples/4_CUDA_Libraries/cuSolverRf/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cuSolverRf/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cuSolverSp_LinearSolver/CMakeLists.txt b/Samples/4_CUDA_Libraries/cuSolverSp_LinearSolver/CMakeLists.txt index 5072c14a..92d273ce 100644 --- a/Samples/4_CUDA_Libraries/cuSolverSp_LinearSolver/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cuSolverSp_LinearSolver/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelCholesky/CMakeLists.txt b/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelCholesky/CMakeLists.txt index cd245806..351a5175 100644 --- a/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelCholesky/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelCholesky/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelQR/CMakeLists.txt b/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelQR/CMakeLists.txt index 5dc46818..fe36e358 100644 --- a/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelQR/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cuSolverSp_LowlevelQR/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/cudaNvSci/CMakeLists.txt b/Samples/4_CUDA_Libraries/cudaNvSci/CMakeLists.txt index 44df0f29..0e25a301 100644 --- a/Samples/4_CUDA_Libraries/cudaNvSci/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/cudaNvSci/CMakeLists.txt @@ -11,38 +11,19 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../Common) +find_package(NVSCI) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Find the NVSCI libraries - # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command - set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH}) - foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH}) - file(GLOB_RECURSE NVSCIBUF_LIB - ${LIBRARY_PATH}/libnvscibuf.so - ${LIBRARY_PATH}/*/libnvscibuf.so - ) - file(GLOB_RECURSE NVSCISYNC_LIB - ${LIBRARY_PATH}/libnvscisync.so - ${LIBRARY_PATH}/*/libnvscisync.so - ) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB) - break() - endif() - endforeach() - - # Find the NVSCI header files - # use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command - set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH}) - find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH}) - find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH}) - - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR) + if(NVSCI_FOUND) message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}") message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}") # Source file @@ -57,14 +38,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_include_directories(cudaNvSci PUBLIC ${CUDAToolkit_INCLUDE_DIRS} - ${NVSCIBUF_INCLUDE_DIR} - ${NVSCISYNC_INCLUDE_DIR} + ${NVSCI_INCLUDE_DIRS} ) target_link_libraries(cudaNvSci CUDA::cuda_driver - ${NVSCIBUF_LIB} - ${NVSCISYNC_LIB} + ${NVSCI_LIBRARIES} ) # Copy teapot1024.ppm to the output directory add_custom_command(TARGET cudaNvSci POST_BUILD diff --git a/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt index c3834cdb..4f04ace7 100644 --- a/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt index 98a4b993..bd2b9b5d 100644 --- a/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt b/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt index 0df38328..428edd44 100644 --- a/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -27,25 +29,16 @@ target_compile_features(jitLto PRIVATE cxx_std_17 cuda_std_17) set_target_properties(jitLto PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +find_library(NVJITLINK_LIB + NAME nvJitLink + PATHS "${CUDAToolkit_LIBRARY_DIR}" "${CMAKE_LIBRARY_PATH}") + target_include_directories(jitLto PRIVATE ${CUDAToolkit_INCLUDE_DIRS} ) - - - target_link_libraries(jitLto PRIVATE - CUDA::cuda_driver - CUDA::nvrtc - ) - -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - target_link_libraries(jitLto PRIVATE - ${CUDAToolkit_LIBRARY_DIR}/libnvJitLink.so - ) -endif() - -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - target_link_libraries(jitLto PRIVATE - ${CUDAToolkit_LIBRARY_DIR}/nvJitLink.lib - ) -endif() +target_link_libraries(jitLto PRIVATE + CUDA::cuda_driver + CUDA::nvrtc + ${NVJITLINK_LIB} +) diff --git a/Samples/4_CUDA_Libraries/lineOfSight/CMakeLists.txt b/Samples/4_CUDA_Libraries/lineOfSight/CMakeLists.txt index 4e39c61f..e3fab2d0 100644 --- a/Samples/4_CUDA_Libraries/lineOfSight/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/lineOfSight/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/matrixMulCUBLAS/CMakeLists.txt b/Samples/4_CUDA_Libraries/matrixMulCUBLAS/CMakeLists.txt index 2838945c..a04c2726 100644 --- a/Samples/4_CUDA_Libraries/matrixMulCUBLAS/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/matrixMulCUBLAS/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/nvJPEG/CMakeLists.txt b/Samples/4_CUDA_Libraries/nvJPEG/CMakeLists.txt index 9e3cfbcf..244c8881 100644 --- a/Samples/4_CUDA_Libraries/nvJPEG/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/nvJPEG/CMakeLists.txt @@ -10,41 +10,37 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../Common) -if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - message(STATUS "Will not build sample nvJPEG - not supported on aarch64") -else() +# Source file +# Add target for nvJPEG +add_executable(nvJPEG nvJPEG.cpp) - # Source file - # Add target for nvJPEG - add_executable(nvJPEG nvJPEG.cpp) +target_compile_options(nvJPEG PRIVATE $<$:--extended-lambda>) - target_compile_options(nvJPEG PRIVATE $<$:--extended-lambda>) +target_compile_features(nvJPEG PRIVATE cxx_std_17 cuda_std_17) - target_compile_features(nvJPEG PRIVATE cxx_std_17 cuda_std_17) +set_target_properties(nvJPEG PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - set_target_properties(nvJPEG PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +target_include_directories(nvJPEG PRIVATE + ${CUDAToolkit_INCLUDE_DIRS} +) - target_include_directories(nvJPEG PRIVATE - ${CUDAToolkit_INCLUDE_DIRS} - ) +target_link_libraries(nvJPEG PRIVATE + CUDA::cudart + CUDA::nvjpeg +) - target_link_libraries(nvJPEG PRIVATE - CUDA::cudart - CUDA::nvjpeg - ) - - # Copy data to the output directory - add_custom_command(TARGET nvJPEG POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/images - ${CMAKE_CURRENT_BINARY_DIR}/images - ) - -endif() +# Copy data to the output directory +add_custom_command(TARGET nvJPEG POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/images + ${CMAKE_CURRENT_BINARY_DIR}/images +) diff --git a/Samples/4_CUDA_Libraries/nvJPEG_encoder/CMakeLists.txt b/Samples/4_CUDA_Libraries/nvJPEG_encoder/CMakeLists.txt index 143e5661..417b5bfc 100644 --- a/Samples/4_CUDA_Libraries/nvJPEG_encoder/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/nvJPEG_encoder/CMakeLists.txt @@ -10,47 +10,43 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../Common) -if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - message(STATUS "Will not build sample nvJPEG_encoder - not supported on aarch64") -else() +# Source file +# Add target for nvJPEG_encoder +add_executable(nvJPEG_encoder nvJPEG_encoder.cpp) - # Source file - # Add target for nvJPEG_encoder - add_executable(nvJPEG_encoder nvJPEG_encoder.cpp) +target_compile_options(nvJPEG_encoder PRIVATE $<$:--extended-lambda>) - target_compile_options(nvJPEG_encoder PRIVATE $<$:--extended-lambda>) +target_compile_features(nvJPEG_encoder PRIVATE cxx_std_17 cuda_std_17) - target_compile_features(nvJPEG_encoder PRIVATE cxx_std_17 cuda_std_17) +set_target_properties(nvJPEG_encoder PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - set_target_properties(nvJPEG_encoder PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +target_include_directories(nvJPEG_encoder PRIVATE + ${CUDAToolkit_INCLUDE_DIRS} +) - target_include_directories(nvJPEG_encoder PRIVATE - ${CUDAToolkit_INCLUDE_DIRS} - ) +target_link_libraries(nvJPEG_encoder PRIVATE + CUDA::cudart + CUDA::nvjpeg +) - target_link_libraries(nvJPEG_encoder PRIVATE - CUDA::cudart - CUDA::nvjpeg - ) +# Copy data to the output directory +add_custom_command(TARGET nvJPEG_encoder POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/images + ${CMAKE_CURRENT_BINARY_DIR}/images +) - # Copy data to the output directory - add_custom_command(TARGET nvJPEG_encoder POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/images - ${CMAKE_CURRENT_BINARY_DIR}/images - ) - - add_custom_command(TARGET nvJPEG_encoder POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/encode_output - ${CMAKE_CURRENT_BINARY_DIR}/encode_output - ) - -endif() +add_custom_command(TARGET nvJPEG_encoder POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/encode_output + ${CMAKE_CURRENT_BINARY_DIR}/encode_output +) diff --git a/Samples/4_CUDA_Libraries/oceanFFT/CMakeLists.txt b/Samples/4_CUDA_Libraries/oceanFFT/CMakeLists.txt index 36314d6d..f79f5741 100644 --- a/Samples/4_CUDA_Libraries/oceanFFT/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/oceanFFT/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/randomFog/CMakeLists.txt b/Samples/4_CUDA_Libraries/randomFog/CMakeLists.txt index f2f7164c..cf6e76da 100644 --- a/Samples/4_CUDA_Libraries/randomFog/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/randomFog/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUBLAS/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUBLAS/CMakeLists.txt index 9667c47c..57e7cc17 100644 --- a/Samples/4_CUDA_Libraries/simpleCUBLAS/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUBLAS/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUBLASXT/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUBLASXT/CMakeLists.txt index 6532f403..bdbc352a 100644 --- a/Samples/4_CUDA_Libraries/simpleCUBLASXT/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUBLASXT/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUBLAS_LU/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUBLAS_LU/CMakeLists.txt index 00061f05..64d76ff5 100644 --- a/Samples/4_CUDA_Libraries/simpleCUBLAS_LU/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUBLAS_LU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUFFT/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUFFT/CMakeLists.txt index 7b871dba..8f70e5d2 100644 --- a/Samples/4_CUDA_Libraries/simpleCUFFT/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUFFT/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUFFT_2d_MGPU/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUFFT_2d_MGPU/CMakeLists.txt index f4d202cc..3784fcb7 100644 --- a/Samples/4_CUDA_Libraries/simpleCUFFT_2d_MGPU/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUFFT_2d_MGPU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUFFT_MGPU/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUFFT_MGPU/CMakeLists.txt index 21782266..5da52a4d 100644 --- a/Samples/4_CUDA_Libraries/simpleCUFFT_MGPU/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUFFT_MGPU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/simpleCUFFT_callback/CMakeLists.txt b/Samples/4_CUDA_Libraries/simpleCUFFT_callback/CMakeLists.txt index 74068fae..521f252f 100644 --- a/Samples/4_CUDA_Libraries/simpleCUFFT_callback/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/simpleCUFFT_callback/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt index a5125a23..74d99dbf 100644 --- a/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/BlackScholes/CMakeLists.txt b/Samples/5_Domain_Specific/BlackScholes/CMakeLists.txt index 31583976..88b7b3c2 100644 --- a/Samples/5_Domain_Specific/BlackScholes/CMakeLists.txt +++ b/Samples/5_Domain_Specific/BlackScholes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/BlackScholes_nvrtc/CMakeLists.txt b/Samples/5_Domain_Specific/BlackScholes_nvrtc/CMakeLists.txt index 440d15e2..8684a4e9 100644 --- a/Samples/5_Domain_Specific/BlackScholes_nvrtc/CMakeLists.txt +++ b/Samples/5_Domain_Specific/BlackScholes_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/FDTD3d/CMakeLists.txt b/Samples/5_Domain_Specific/FDTD3d/CMakeLists.txt index 45ef61c4..8defd030 100644 --- a/Samples/5_Domain_Specific/FDTD3d/CMakeLists.txt +++ b/Samples/5_Domain_Specific/FDTD3d/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/HSOpticalFlow/CMakeLists.txt b/Samples/5_Domain_Specific/HSOpticalFlow/CMakeLists.txt index 103e07cd..c8198113 100644 --- a/Samples/5_Domain_Specific/HSOpticalFlow/CMakeLists.txt +++ b/Samples/5_Domain_Specific/HSOpticalFlow/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/Mandelbrot/CMakeLists.txt b/Samples/5_Domain_Specific/Mandelbrot/CMakeLists.txt index 97f1fd72..af4c103f 100644 --- a/Samples/5_Domain_Specific/Mandelbrot/CMakeLists.txt +++ b/Samples/5_Domain_Specific/Mandelbrot/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/MonteCarloMultiGPU/CMakeLists.txt b/Samples/5_Domain_Specific/MonteCarloMultiGPU/CMakeLists.txt index 084f7c83..d6433daf 100644 --- a/Samples/5_Domain_Specific/MonteCarloMultiGPU/CMakeLists.txt +++ b/Samples/5_Domain_Specific/MonteCarloMultiGPU/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/NV12toBGRandResize/CMakeLists.txt b/Samples/5_Domain_Specific/NV12toBGRandResize/CMakeLists.txt index 656f9c2c..e607a7ab 100644 --- a/Samples/5_Domain_Specific/NV12toBGRandResize/CMakeLists.txt +++ b/Samples/5_Domain_Specific/NV12toBGRandResize/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/SobelFilter/CMakeLists.txt b/Samples/5_Domain_Specific/SobelFilter/CMakeLists.txt index a84e878e..3bd61f31 100644 --- a/Samples/5_Domain_Specific/SobelFilter/CMakeLists.txt +++ b/Samples/5_Domain_Specific/SobelFilter/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/SobolQRNG/CMakeLists.txt b/Samples/5_Domain_Specific/SobolQRNG/CMakeLists.txt index 2c88381c..6202987d 100644 --- a/Samples/5_Domain_Specific/SobolQRNG/CMakeLists.txt +++ b/Samples/5_Domain_Specific/SobolQRNG/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/bicubicTexture/CMakeLists.txt b/Samples/5_Domain_Specific/bicubicTexture/CMakeLists.txt index 168f3844..c63b20cb 100644 --- a/Samples/5_Domain_Specific/bicubicTexture/CMakeLists.txt +++ b/Samples/5_Domain_Specific/bicubicTexture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/bilateralFilter/CMakeLists.txt b/Samples/5_Domain_Specific/bilateralFilter/CMakeLists.txt index 1c903010..ac68dd45 100644 --- a/Samples/5_Domain_Specific/bilateralFilter/CMakeLists.txt +++ b/Samples/5_Domain_Specific/bilateralFilter/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/binomialOptions/CMakeLists.txt b/Samples/5_Domain_Specific/binomialOptions/CMakeLists.txt index 90d53c70..2e12e1bc 100644 --- a/Samples/5_Domain_Specific/binomialOptions/CMakeLists.txt +++ b/Samples/5_Domain_Specific/binomialOptions/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/binomialOptions_nvrtc/CMakeLists.txt b/Samples/5_Domain_Specific/binomialOptions_nvrtc/CMakeLists.txt index 815be7c4..19914ad2 100644 --- a/Samples/5_Domain_Specific/binomialOptions_nvrtc/CMakeLists.txt +++ b/Samples/5_Domain_Specific/binomialOptions_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/convolutionFFT2D/CMakeLists.txt b/Samples/5_Domain_Specific/convolutionFFT2D/CMakeLists.txt index 5052b6a4..74bebaf6 100644 --- a/Samples/5_Domain_Specific/convolutionFFT2D/CMakeLists.txt +++ b/Samples/5_Domain_Specific/convolutionFFT2D/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/dwtHaar1D/CMakeLists.txt b/Samples/5_Domain_Specific/dwtHaar1D/CMakeLists.txt index 116332f0..2a951f23 100644 --- a/Samples/5_Domain_Specific/dwtHaar1D/CMakeLists.txt +++ b/Samples/5_Domain_Specific/dwtHaar1D/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/dxtc/CMakeLists.txt b/Samples/5_Domain_Specific/dxtc/CMakeLists.txt index 9912ea55..471a75cf 100644 --- a/Samples/5_Domain_Specific/dxtc/CMakeLists.txt +++ b/Samples/5_Domain_Specific/dxtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/fastWalshTransform/CMakeLists.txt b/Samples/5_Domain_Specific/fastWalshTransform/CMakeLists.txt index 2d03b54b..dd5d39f8 100644 --- a/Samples/5_Domain_Specific/fastWalshTransform/CMakeLists.txt +++ b/Samples/5_Domain_Specific/fastWalshTransform/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/fluidsGL/CMakeLists.txt b/Samples/5_Domain_Specific/fluidsGL/CMakeLists.txt index 1443ce3c..8ba01f3f 100644 --- a/Samples/5_Domain_Specific/fluidsGL/CMakeLists.txt +++ b/Samples/5_Domain_Specific/fluidsGL/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/marchingCubes/CMakeLists.txt b/Samples/5_Domain_Specific/marchingCubes/CMakeLists.txt index adeedd7d..a6fe9e94 100644 --- a/Samples/5_Domain_Specific/marchingCubes/CMakeLists.txt +++ b/Samples/5_Domain_Specific/marchingCubes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/nbody/CMakeLists.txt b/Samples/5_Domain_Specific/nbody/CMakeLists.txt index e4860df1..be99daf3 100644 --- a/Samples/5_Domain_Specific/nbody/CMakeLists.txt +++ b/Samples/5_Domain_Specific/nbody/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/p2pBandwidthLatencyTest/CMakeLists.txt b/Samples/5_Domain_Specific/p2pBandwidthLatencyTest/CMakeLists.txt index 2456aca5..cd485714 100644 --- a/Samples/5_Domain_Specific/p2pBandwidthLatencyTest/CMakeLists.txt +++ b/Samples/5_Domain_Specific/p2pBandwidthLatencyTest/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/postProcessGL/CMakeLists.txt b/Samples/5_Domain_Specific/postProcessGL/CMakeLists.txt index f96ae7c1..dd272bbc 100644 --- a/Samples/5_Domain_Specific/postProcessGL/CMakeLists.txt +++ b/Samples/5_Domain_Specific/postProcessGL/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/quasirandomGenerator/CMakeLists.txt b/Samples/5_Domain_Specific/quasirandomGenerator/CMakeLists.txt index c84368d8..40ee2936 100644 --- a/Samples/5_Domain_Specific/quasirandomGenerator/CMakeLists.txt +++ b/Samples/5_Domain_Specific/quasirandomGenerator/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/quasirandomGenerator_nvrtc/CMakeLists.txt b/Samples/5_Domain_Specific/quasirandomGenerator_nvrtc/CMakeLists.txt index a1e50d88..33539c81 100644 --- a/Samples/5_Domain_Specific/quasirandomGenerator_nvrtc/CMakeLists.txt +++ b/Samples/5_Domain_Specific/quasirandomGenerator_nvrtc/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/recursiveGaussian/CMakeLists.txt b/Samples/5_Domain_Specific/recursiveGaussian/CMakeLists.txt index b596cca6..1ee9675d 100644 --- a/Samples/5_Domain_Specific/recursiveGaussian/CMakeLists.txt +++ b/Samples/5_Domain_Specific/recursiveGaussian/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/simpleD3D11/CMakeLists.txt b/Samples/5_Domain_Specific/simpleD3D11/CMakeLists.txt index d9ecadd7..7222dead 100644 --- a/Samples/5_Domain_Specific/simpleD3D11/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleD3D11/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/simpleD3D11Texture/CMakeLists.txt b/Samples/5_Domain_Specific/simpleD3D11Texture/CMakeLists.txt index 546cee4c..1f6f5cc4 100644 --- a/Samples/5_Domain_Specific/simpleD3D11Texture/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleD3D11Texture/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/simpleD3D12/CMakeLists.txt b/Samples/5_Domain_Specific/simpleD3D12/CMakeLists.txt index b512f99c..82b70fae 100644 --- a/Samples/5_Domain_Specific/simpleD3D12/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleD3D12/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/simpleGL/CMakeLists.txt b/Samples/5_Domain_Specific/simpleGL/CMakeLists.txt index 0b032145..ace2cce3 100644 --- a/Samples/5_Domain_Specific/simpleGL/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleGL/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/simpleVulkan/CMakeLists.txt b/Samples/5_Domain_Specific/simpleVulkan/CMakeLists.txt index 01399e69..e6bd2f30 100644 --- a/Samples/5_Domain_Specific/simpleVulkan/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleVulkan/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -28,10 +30,14 @@ include(CheckIncludeFile) check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H) # Find GLFW header and lib for Windows -if(WIN32) - find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}") - find_library(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}") - if(GLFW3_H AND GLFW3_LIB) +if(WIN32 OR CMAKE_CROSSCOMPILING) + set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}") + find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS}) + find_library(GLFW3_LIB + NAMES glfw3 glfw + PATHS "${GLFW_LIB_DIR}" + PATH_SUFFIXES lib lib64) + if(GLFW3_H AND GLFW3_LIB) message(STATUS "Found GLFW/glfw3.h and GLFW library.") set(HAVE_GLFW3_H 1) endif() @@ -58,9 +64,9 @@ if(${Vulkan_FOUND}) ${Vulkan_LIBRARIES} OpenGL::GL ) - if(WIN32) + if(WIN32 OR CMAKE_CROSSCOMPILING) target_include_directories(simpleVulkan PUBLIC - ${GLFW_INCLUDE_DIR} + ${GLFW_INCLUDE_DIRS} ) target_link_libraries(simpleVulkan ${GLFW3_LIB} diff --git a/Samples/5_Domain_Specific/simpleVulkanMMAP/CMakeLists.txt b/Samples/5_Domain_Specific/simpleVulkanMMAP/CMakeLists.txt index d5d3555f..48efbd27 100644 --- a/Samples/5_Domain_Specific/simpleVulkanMMAP/CMakeLists.txt +++ b/Samples/5_Domain_Specific/simpleVulkanMMAP/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -27,10 +29,14 @@ include(CheckIncludeFile) check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H) # Find GLFW header and lib for Windows -if(WIN32) - find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}") - find_library(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}") - if(GLFW3_H AND GLFW3_LIB) +if(WIN32 OR CMAKE_CROSSCOMPILING) + set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}") + find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS}) + find_library(GLFW3_LIB + NAMES glfw3 glfw + PATHS "${GLFW_LIB_DIR}" + PATH_SUFFIXES lib lib64) + if(GLFW3_H AND GLFW3_LIB) message(STATUS "Found GLFW/glfw3.h and GLFW library.") set(HAVE_GLFW3_H 1) endif() @@ -58,9 +64,9 @@ if(${Vulkan_FOUND}) OpenGL::GL CUDA::cuda_driver ) - if(WIN32) + if(WIN32 OR CMAKE_CROSSCOMPILING) target_include_directories(simpleVulkanMMAP PUBLIC - ${GLFW_INCLUDE_DIR} + ${GLFW_INCLUDE_DIRS} ) target_link_libraries(simpleVulkanMMAP ${GLFW3_LIB} diff --git a/Samples/5_Domain_Specific/smokeParticles/CMakeLists.txt b/Samples/5_Domain_Specific/smokeParticles/CMakeLists.txt index 482c9811..7f31868d 100644 --- a/Samples/5_Domain_Specific/smokeParticles/CMakeLists.txt +++ b/Samples/5_Domain_Specific/smokeParticles/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/stereoDisparity/CMakeLists.txt b/Samples/5_Domain_Specific/stereoDisparity/CMakeLists.txt index 630c71a6..dbd41779 100644 --- a/Samples/5_Domain_Specific/stereoDisparity/CMakeLists.txt +++ b/Samples/5_Domain_Specific/stereoDisparity/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/volumeFiltering/CMakeLists.txt b/Samples/5_Domain_Specific/volumeFiltering/CMakeLists.txt index eacc5c8e..6b225790 100644 --- a/Samples/5_Domain_Specific/volumeFiltering/CMakeLists.txt +++ b/Samples/5_Domain_Specific/volumeFiltering/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/volumeRender/CMakeLists.txt b/Samples/5_Domain_Specific/volumeRender/CMakeLists.txt index d8a05ca8..342584cb 100644 --- a/Samples/5_Domain_Specific/volumeRender/CMakeLists.txt +++ b/Samples/5_Domain_Specific/volumeRender/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/5_Domain_Specific/vulkanImageCUDA/CMakeLists.txt b/Samples/5_Domain_Specific/vulkanImageCUDA/CMakeLists.txt index 88bd3cd2..93c67767 100644 --- a/Samples/5_Domain_Specific/vulkanImageCUDA/CMakeLists.txt +++ b/Samples/5_Domain_Specific/vulkanImageCUDA/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -27,10 +29,14 @@ include(CheckIncludeFile) check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H) # Find GLFW header and lib for Windows -if(WIN32) - find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}") - find_file(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}") - if(GLFW3_H AND GLFW3_LIB) +if(WIN32 OR CMAKE_CROSSCOMPILING) + set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}") + find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS}) + find_library(GLFW3_LIB + NAMES glfw3 glfw + PATHS "${GLFW_LIB_DIR}" + PATH_SUFFIXES lib lib64) + if(GLFW3_H AND GLFW3_LIB) message(STATUS "Found GLFW/glfw3.h and GLFW library.") set(HAVE_GLFW3_H 1) endif() @@ -57,9 +63,9 @@ if(${Vulkan_FOUND}) ${Vulkan_LIBRARIES} OpenGL::GL ) - if(WIN32) + if(WIN32 OR CMAKE_CROSSCOMPILING) target_include_directories(vulkanImageCUDA PUBLIC - ${GLFW_INCLUDE_DIR} + ${GLFW_INCLUDE_DIRS} ) target_link_libraries(vulkanImageCUDA ${GLFW3_LIB} diff --git a/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt b/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt index 422ac70b..08c5dd61 100644 --- a/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt +++ b/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt b/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt index 2ce6a06c..1cea77f3 100644 --- a/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt +++ b/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/6_Performance/alignedTypes/CMakeLists.txt b/Samples/6_Performance/alignedTypes/CMakeLists.txt index 0f4a4a9b..ea89b73c 100644 --- a/Samples/6_Performance/alignedTypes/CMakeLists.txt +++ b/Samples/6_Performance/alignedTypes/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt b/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt index 754b6767..f56e0401 100644 --- a/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt +++ b/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/6_Performance/transpose/CMakeLists.txt b/Samples/6_Performance/transpose/CMakeLists.txt index 820b0333..0271319d 100644 --- a/Samples/6_Performance/transpose/CMakeLists.txt +++ b/Samples/6_Performance/transpose/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/7_libNVVM/CMakeLists.txt b/Samples/7_libNVVM/CMakeLists.txt index 1706e7c4..e29f349b 100644 --- a/Samples/7_libNVVM/CMakeLists.txt +++ b/Samples/7_libNVVM/CMakeLists.txt @@ -82,7 +82,12 @@ message(STATUS "Using libnvvm library: ${NVVM_LIB}") # Set the rpath to libnvvm. find_path(LIBNVVM_RPATH lib lib64 PATHS "$ENV{LIBNVVM_HOME}" "${CUDA_HOME}") -get_filename_component(LIBNVVM_RPATH ${NVVM_LIB} DIRECTORY) +if(DEFINED RUNTIME_LIBNVVM_PATH) + message(STATUS "Using RUNTIME_LIBNVVM_PATH: ${RUNTIME_LIBNVVM_PATH}") + set(LIBNVVM_RPATH ${RUNTIME_LIBNVVM_PATH}) +else() + get_filename_component(LIBNVVM_RPATH ${NVVM_LIB} DIRECTORY) +endif() set(CMAKE_INSTALL_RPATH "${LIBNVVM_RPATH}") message(STATUS "Using rpath: ${CMAKE_INSTALL_RPATH}") diff --git a/Samples/7_libNVVM/cuda-c-linking/CMakeLists.txt b/Samples/7_libNVVM/cuda-c-linking/CMakeLists.txt index cd8a943e..ec70a1d4 100644 --- a/Samples/7_libNVVM/cuda-c-linking/CMakeLists.txt +++ b/Samples/7_libNVVM/cuda-c-linking/CMakeLists.txt @@ -89,4 +89,4 @@ if (WIN32) COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$" ) -endif () \ No newline at end of file +endif () diff --git a/Samples/7_libNVVM/ptxgen/CMakeLists.txt b/Samples/7_libNVVM/ptxgen/CMakeLists.txt index aa136e17..b13866a8 100644 --- a/Samples/7_libNVVM/ptxgen/CMakeLists.txt +++ b/Samples/7_libNVVM/ptxgen/CMakeLists.txt @@ -33,12 +33,18 @@ set_tests_properties(ptxgenTest PROPERTIES FIXTURES_SETUP PTXGENTEST) target_link_libraries(ptxgen ${NVVM_LIB}) +if (DEFINED RUNTIME_LIBNVVM_PATH) + get_filename_component(_LIBNVVM_HOME "${RUNTIME_LIBNVVM_PATH}" DIRECTORY) +else () + set(_LIBNVVM_HOME "${LIBNVVM_HOME}") +endif () + if (WIN32) set_target_properties(ptxgen PROPERTIES COMPILE_FLAGS "/wd4996 -DLIBNVVM_HOME=\"${LIBNVVM_HOME}\"") else (WIN32) set_target_properties(ptxgen PROPERTIES - COMPILE_FLAGS "-DLIBNVVM_HOME=\"${LIBNVVM_HOME}\"" + COMPILE_FLAGS "-DLIBNVVM_HOME=\"${_LIBNVVM_HOME}\"" LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}") endif (WIN32) diff --git a/Samples/8_Platform_Specific/Tegra/EGLSync_CUDAEvent_Interop/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/EGLSync_CUDAEvent_Interop/CMakeLists.txt index ee8ce450..85f72792 100644 --- a/Samples/8_Platform_Specific/Tegra/EGLSync_CUDAEvent_Interop/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/EGLSync_CUDAEvent_Interop/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/8_Platform_Specific/Tegra/cuDLAErrorReporting/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cuDLAErrorReporting/CMakeLists.txt index 472515ab..42e2f1aa 100644 --- a/Samples/8_Platform_Specific/Tegra/cuDLAErrorReporting/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cuDLAErrorReporting/CMakeLists.txt @@ -11,14 +11,16 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) -find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR}) +find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CUDLA_LIB) diff --git a/Samples/8_Platform_Specific/Tegra/cuDLAHybridMode/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cuDLAHybridMode/CMakeLists.txt index 6c62dc12..0a4e81c0 100644 --- a/Samples/8_Platform_Specific/Tegra/cuDLAHybridMode/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cuDLAHybridMode/CMakeLists.txt @@ -11,14 +11,16 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) -find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR}) +find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CUDLA_LIB) diff --git a/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsHybrid/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsHybrid/CMakeLists.txt index 11838818..94dc0cb5 100644 --- a/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsHybrid/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsHybrid/CMakeLists.txt @@ -11,14 +11,16 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) -find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR}) +find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CUDLA_LIB) diff --git a/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsStandalone/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsStandalone/CMakeLists.txt index 8a36e5bf..2b82a3aa 100644 --- a/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsStandalone/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cuDLALayerwiseStatsStandalone/CMakeLists.txt @@ -11,41 +11,21 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) -find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR}) +find_package(NVSCI) +find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CUDLA_LIB) - # Find the NVSCI libraries - # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command - set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH}) - foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH}) - file(GLOB_RECURSE NVSCIBUF_LIB - ${LIBRARY_PATH}/libnvscibuf.so - ${LIBRARY_PATH}/*/libnvscibuf.so - ) - file(GLOB_RECURSE NVSCISYNC_LIB - ${LIBRARY_PATH}/libnvscisync.so - ${LIBRARY_PATH}/*/libnvscisync.so - ) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB) - break() - endif() - endforeach() - - # Find the NVSCI header files - # use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command - set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH}) - find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH}) - find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH}) - - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR) + if(NVSCI_FOUND) # Source file # Add target for cuDLALayerwiseStatsStandalone add_executable(cuDLALayerwiseStatsStandalone main.cpp) @@ -58,14 +38,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_include_directories(cuDLALayerwiseStatsStandalone PUBLIC ${CUDAToolkit_INCLUDE_DIRS} - ${NVSCIBUF_INCLUDE_DIR} - ${NVSCISYNC_INCLUDE_DIR} + ${NVSCI_INCLUDE_DIRS} ) target_link_libraries(cuDLALayerwiseStatsStandalone ${CUDLA_LIB} - ${NVSCIBUF_LIB} - ${NVSCISYNC_LIB} + ${NVSCI_LIBRARIES} ) else() message(STATUS "NvSCI not found - will not build sample 'cuDLALayerwiseStatsStandalone'") diff --git a/Samples/8_Platform_Specific/Tegra/cuDLAStandaloneMode/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cuDLAStandaloneMode/CMakeLists.txt index 468a0126..9558a7c5 100644 --- a/Samples/8_Platform_Specific/Tegra/cuDLAStandaloneMode/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cuDLAStandaloneMode/CMakeLists.txt @@ -11,41 +11,21 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) -find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR}) +find_package(NVSCI) +find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CUDLA_LIB) - # Find the NVSCI libraries - # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command - set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH}) - foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH}) - file(GLOB_RECURSE NVSCIBUF_LIB - ${LIBRARY_PATH}/libnvscibuf.so - ${LIBRARY_PATH}/*/libnvscibuf.so - ) - file(GLOB_RECURSE NVSCISYNC_LIB - ${LIBRARY_PATH}/libnvscisync.so - ${LIBRARY_PATH}/*/libnvscisync.so - ) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB) - break() - endif() - endforeach() - - # Find the NVSCI header files - # use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command - set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH}) - find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH}) - find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH}) - - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR) + if(NVSCI_FOUND) # Source file # Add target for cuDLAStandaloneMode add_executable(cuDLAStandaloneMode main.cpp) @@ -58,14 +38,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_include_directories(cuDLAStandaloneMode PUBLIC ${CUDAToolkit_INCLUDE_DIRS} - ${NVSCIBUF_INCLUDE_DIR} - ${NVSCISYNC_INCLUDE_DIR} + ${NVSCI_INCLUDE_DIRS} ) target_link_libraries(cuDLAStandaloneMode ${CUDLA_LIB} - ${NVSCIBUF_LIB} - ${NVSCISYNC_LIB} + ${NVSCI_LIBRARIES} ) else() message(STATUS "NvSCI not found - will not build sample 'cuDLAStandaloneMode'") diff --git a/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/CMakeLists.txt index 4475806e..af982db2 100644 --- a/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/CMakeLists.txt @@ -11,40 +11,19 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) +find_package(NVSCI) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Find the NVSCI libraries - # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command - set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH}) - foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH}) - file(GLOB_RECURSE NVSCIBUF_LIB - ${LIBRARY_PATH}/libnvscibuf.so - ${LIBRARY_PATH}/*/libnvscibuf.so - ) - file(GLOB_RECURSE NVSCISYNC_LIB - ${LIBRARY_PATH}/libnvscisync.so - ${LIBRARY_PATH}/*/libnvscisync.so - ) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB) - break() - endif() - endforeach() - - # Find the NVSCI header files - # use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command - set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH}) - find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH}) - find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH}) - - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR) - message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}") - message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}") + if(NVSCI_FOUND) # Source file # Add target for cudaNvSciBufMultiplanar add_executable(cudaNvSciBufMultiplanar imageKernels.cu cudaNvSciBufMultiplanar.cpp main.cpp) @@ -57,14 +36,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_include_directories(cudaNvSciBufMultiplanar PUBLIC ${CUDAToolkit_INCLUDE_DIRS} - ${NVSCIBUF_INCLUDE_DIR} - ${NVSCISYNC_INCLUDE_DIR} + ${NVSCI_INCLUDE_DIRS} ) target_link_libraries(cudaNvSciBufMultiplanar CUDA::cuda_driver - ${NVSCIBUF_LIB} - ${NVSCISYNC_LIB} + ${NVSCI_LIBRARIES} ) # Copy yuv_planar_img1.yuv to the output directory add_custom_command(TARGET cudaNvSciBufMultiplanar POST_BUILD diff --git a/Samples/8_Platform_Specific/Tegra/cudaNvSciNvMedia/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/cudaNvSciNvMedia/CMakeLists.txt index 731f358c..f2f4d749 100644 --- a/Samples/8_Platform_Specific/Tegra/cudaNvSciNvMedia/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/cudaNvSciNvMedia/CMakeLists.txt @@ -11,31 +11,27 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries include_directories(../../../../Common) +find_package(NVSCI) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") # Find the NVSCI/NVMEDIA libraries # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH}) foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH}) - file(GLOB_RECURSE NVSCIBUF_LIB - ${LIBRARY_PATH}/libnvscibuf.so - ${LIBRARY_PATH}/*/libnvscibuf.so - ) - file(GLOB_RECURSE NVSCISYNC_LIB - ${LIBRARY_PATH}/libnvscisync.so - ${LIBRARY_PATH}/*/libnvscisync.so - ) file(GLOB_RECURSE NVMEDIA_LIB ${LIBRARY_PATH}/libnvmedia.so ${LIBRARY_PATH}/*/libnvmedia.so ) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVMEDIA_LIB) + if(NVMEDIA_LIB) break() endif() endforeach() @@ -47,13 +43,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/include" ${CMAKE_LIBRARY_PATH} ) - find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH}) - find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH}) find_path(NVMEDIA_INCLUDE_DIR nvmedia_core.h PATHS ${CMAKE_INCLUDE_PATH}) - if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR) - message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}") - message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}") + if(NVSCI_FOUND) if(NVMEDIA_LIB AND NVMEDIA_INCLUDE_DIR) message(STATUS "FOUND NVMEDIA libs: ${NVMEDIA_LIB}") message(STATUS "Using NVMEDIA headers path: ${NVMEDIA_INCLUDE_DIR}") @@ -69,15 +61,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_include_directories(cudaNvSciNvMedia PUBLIC ${CUDAToolkit_INCLUDE_DIRS} - ${NVSCIBUF_INCLUDE_DIR} - ${NVSCISYNC_INCLUDE_DIR} + ${NVSCI_INCLUDE_DIRS} ${NVMEDIA_INCLUDE_DIR} ) target_link_libraries(cudaNvSciNvMedia CUDA::cuda_driver - ${NVSCIBUF_LIB} - ${NVSCISYNC_LIB} + ${NVSCI_LIBRARIES} ${NVMEDIA_LIB} ) # Copy teapot.rgba to the output directory diff --git a/Samples/8_Platform_Specific/Tegra/fluidsGLES/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/fluidsGLES/CMakeLists.txt index edb3c1a5..6cd6a5fb 100644 --- a/Samples/8_Platform_Specific/Tegra/fluidsGLES/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/fluidsGLES/CMakeLists.txt @@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/8_Platform_Specific/Tegra/nbody_opengles/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/nbody_opengles/CMakeLists.txt index 406c52cd..43484fbe 100644 --- a/Samples/8_Platform_Specific/Tegra/nbody_opengles/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/nbody_opengles/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/8_Platform_Specific/Tegra/simpleGLES/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/simpleGLES/CMakeLists.txt index 1b7865bd..52dc2f7f 100644 --- a/Samples/8_Platform_Specific/Tegra/simpleGLES/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/simpleGLES/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries diff --git a/Samples/8_Platform_Specific/Tegra/simpleGLES_EGLOutput/CMakeLists.txt b/Samples/8_Platform_Specific/Tegra/simpleGLES_EGLOutput/CMakeLists.txt index 6fa0edf5..bc0b2072 100644 --- a/Samples/8_Platform_Specific/Tegra/simpleGLES_EGLOutput/CMakeLists.txt +++ b/Samples/8_Platform_Specific/Tegra/simpleGLES_EGLOutput/CMakeLists.txt @@ -11,8 +11,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CUDA_ARCHITECTURES 72 87 101) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +if(ENABLE_CUDA_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) +else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") # add line information to all builds for debug tools (exclusive to -G option) endif() # Include directories and libraries @@ -26,7 +28,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(${OpenGL_FOUND}) if(${EGL_FOUND}) if(${X11_FOUND}) - set(DRM_INCLUDE_PATH "/usr/include/drm" "/usr/include/libdrm") + set(DRM_INCLUDE_PATH "/usr/include/drm" "/usr/include/libdrm" ${CMAKE_INCLUDE_PATH}) # use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command set(CMAKE_LIBRARY_PATH "/usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu" ${CMAKE_LIBRARY_PATH}) diff --git a/cmake/Modules/FindFreeImage.cmake b/cmake/Modules/FindFreeImage.cmake index b03e99eb..8e6ade45 100644 --- a/cmake/Modules/FindFreeImage.cmake +++ b/cmake/Modules/FindFreeImage.cmake @@ -4,7 +4,7 @@ find_path(FreeImage_INCLUDE_DIR ) find_library(FreeImage_LIBRARY - NAMES freeimage + NAMES freeimage FreeImage PATHS /usr/lib /usr/local/lib ) diff --git a/cmake/Modules/FindNVSCI.cmake b/cmake/Modules/FindNVSCI.cmake new file mode 100644 index 00000000..198e2b89 --- /dev/null +++ b/cmake/Modules/FindNVSCI.cmake @@ -0,0 +1,61 @@ +# Find the NVSCI libraries and headers +# +# This module defines the following variables: +# NVSCI_FOUND - True if NVSCI was found +# NVSCI_INCLUDE_DIRS - NVSCI include directories +# NVSCI_LIBRARIES - NVSCI libraries +# NVSCIBUF_LIBRARY - NVSCI buffer library +# NVSCISYNC_LIBRARY - NVSCI sync library + +# Find the libraries +find_library(NVSCIBUF_LIBRARY + NAMES nvscibuf libnvscibuf + PATHS + /usr/lib + /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu + PATH_SUFFIXES nvidia +) + +find_library(NVSCISYNC_LIBRARY + NAMES nvscisync libnvscisync + PATHS + $/usr/lib + $/usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu + PATH_SUFFIXES nvidia +) + +# Find the header files +find_path(NVSCIBUF_INCLUDE_DIR + NAMES nvscibuf.h + PATHS + /usr/include + /usr/local/include +) + +find_path(NVSCISYNC_INCLUDE_DIR + NAMES nvscisync.h + PATHS + /usr/include + /usr/local/include +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NVSCI + REQUIRED_VARS + NVSCIBUF_LIBRARY + NVSCISYNC_LIBRARY + NVSCIBUF_INCLUDE_DIR + NVSCISYNC_INCLUDE_DIR +) + +if(NVSCI_FOUND) + set(NVSCI_LIBRARIES ${NVSCIBUF_LIBRARY} ${NVSCISYNC_LIBRARY}) + set(NVSCI_INCLUDE_DIRS ${NVSCIBUF_INCLUDE_DIR} ${NVSCISYNC_INCLUDE_DIR}) +endif() + +mark_as_advanced( + NVSCIBUF_LIBRARY + NVSCISYNC_LIBRARY + NVSCIBUF_INCLUDE_DIR + NVSCISYNC_INCLUDE_DIR +) diff --git a/cmake/toolchains/toolchain-aarch64-linux.cmake b/cmake/toolchains/toolchain-aarch64-linux.cmake new file mode 100644 index 00000000..912d0dd5 --- /dev/null +++ b/cmake/toolchains/toolchain-aarch64-linux.cmake @@ -0,0 +1,59 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +# Specify the cross-compilers +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) +set(CMAKE_AR aarch64-linux-gnu-ar) +set(CMAKE_RANLIB aarch64-linux-gnu-ranlib) + +# Indicate cross-compiling. +set(CMAKE_CROSSCOMPILING TRUE) + +# Set CUDA compiler flags +set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -ccbin ${CMAKE_CXX_COMPILER}" CACHE STRING "" FORCE) + +# Use a local sysroot copy +if(DEFINED TARGET_FS) + set(CMAKE_SYSROOT "${TARGET_FS}") + list(APPEND CMAKE_FIND_ROOT_PATH + "/usr/local/cuda/targets/aarch64-linux" + ) + + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler --sysroot=${TARGET_FS}") + + set(LIB_PATHS + "${TARGET_FS}/usr/lib/" + "${TARGET_FS}/usr/lib/aarch64-linux-gnu" + "${TARGET_FS}/usr/lib/aarch64-linux-gnu/nvidia" + ) + # Add rpath-link flags for all library paths + foreach(lib_path ${LIB_PATHS}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${lib_path}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${lib_path}") + endforeach() + + # Add the real path of CUDA installation on TARGET_FS for nvvm + find_program(TARGET_CUDA_NVCC_PATH nvcc + PATH "${TARGET_FS}/usr/local/cuda/bin" + NO_DEFAULT_PATH + NO_CMAKE_PATH + ) + if(TARGET_CUDA_NVCC_PATH) + # Get the real path of CUDA installation on TARGET_FS + get_filename_component(TARGET_CUDA_PATH "${TARGET_CUDA_NVCC_PATH}" REALPATH) + get_filename_component(TARGET_CUDA_ROOT "${TARGET_CUDA_PATH}" DIRECTORY) + get_filename_component(TARGET_CUDA_ROOT "${TARGET_CUDA_ROOT}" DIRECTORY) + endif() + + if (DEFINED TARGET_CUDA_ROOT) + list(APPEND CMAKE_LIBRARY_PATH "${TARGET_CUDA_ROOT}/targets/aarch64-linux/lib") + # Define NVVM paths for build and runtime + set(ENV{LIBNVVM_HOME} "${TARGET_CUDA_ROOT}") + set(RUNTIME_LIBNVVM_PATH "${TARGET_CUDA_ROOT}/nvvm/lib64") + endif() +endif()