From cbfab74480e60780b920ce57027a2b6046b978ee Mon Sep 17 00:00:00 2001 From: Rob Armstrong Date: Mon, 16 Dec 2024 14:52:10 -0800 Subject: [PATCH] Refactor CMakeLists.txt under 6_Performance --- .../LargeKernelParameter/CMakeLists.txt | 24 +++++++++++++---- .../UnifiedMemoryPerf/CMakeLists.txt | 26 ++++++++++++++----- .../6_Performance/alignedTypes/CMakeLists.txt | 24 +++++++++++++---- .../cudaGraphsPerfScaling/CMakeLists.txt | 24 +++++++++++++---- .../6_Performance/transpose/CMakeLists.txt | 24 +++++++++++++---- 5 files changed, 95 insertions(+), 27 deletions(-) diff --git a/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt b/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt index db8ea97c..abb3e117 100644 --- a/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt +++ b/Samples/6_Performance/LargeKernelParameter/CMakeLists.txt @@ -1,11 +1,25 @@ +cmake_minimum_required(VERSION 3.20) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") + +project(LargeKernelParameter LANGUAGES C CXX CUDA) + +find_package(CUDAToolkit REQUIRED) + +set(CMAKE_CUDA_ARCHITECTURES 70 75 80 86 89 90) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +endif() + # Include directories and libraries include_directories(../../../Common) # Source file -set(SRC_FILES - LargeKernelParameter.cu -) - # Add target for LargeKernelParameter -add_executable(LargeKernelParameter ${SRC_FILES}) +add_executable(LargeKernelParameter LargeKernelParameter.cu) + +target_compile_options(LargeKernelParameter PRIVATE $<$:--extended-lambda>) + +target_compile_features(LargeKernelParameter PRIVATE cxx_std_17 cuda_std_17) + set_target_properties(LargeKernelParameter PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt b/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt index 5e23cbf5..121d25db 100644 --- a/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt +++ b/Samples/6_Performance/UnifiedMemoryPerf/CMakeLists.txt @@ -1,15 +1,27 @@ +cmake_minimum_required(VERSION 3.20) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") + +project(UnifiedMemoryPerf LANGUAGES C CXX CUDA) + +find_package(CUDAToolkit REQUIRED) + +set(CMAKE_CUDA_ARCHITECTURES "native") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +endif() + # Include directories and libraries include_directories(../../../Common) # Source file -set(SRC_FILES - helperFunctions.cpp - matrixMultiplyPerf.cu - commonKernels.cu -) - # Add target for UnifiedMemoryPerf -add_executable(UnifiedMemoryPerf ${SRC_FILES}) +add_executable(UnifiedMemoryPerf helperFunctions.cpp matrixMultiplyPerf.cu commonKernels.cu) + +target_compile_options(UnifiedMemoryPerf PRIVATE $<$:--extended-lambda>) + +target_compile_features(UnifiedMemoryPerf PRIVATE cxx_std_17 cuda_std_17) + set_target_properties(UnifiedMemoryPerf PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_include_directories(UnifiedMemoryPerf PRIVATE diff --git a/Samples/6_Performance/alignedTypes/CMakeLists.txt b/Samples/6_Performance/alignedTypes/CMakeLists.txt index 571b1b44..baf5263e 100644 --- a/Samples/6_Performance/alignedTypes/CMakeLists.txt +++ b/Samples/6_Performance/alignedTypes/CMakeLists.txt @@ -1,11 +1,25 @@ +cmake_minimum_required(VERSION 3.20) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") + +project(alignedTypes LANGUAGES C CXX CUDA) + +find_package(CUDAToolkit REQUIRED) + +set(CMAKE_CUDA_ARCHITECTURES "native") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +endif() + # Include directories and libraries include_directories(../../../Common) # Source file -set(SRC_FILES - alignedTypes.cu -) - # Add target for alignedTypes -add_executable(alignedTypes ${SRC_FILES}) +add_executable(alignedTypes alignedTypes.cu) + +target_compile_options(alignedTypes PRIVATE $<$:--extended-lambda>) + +target_compile_features(alignedTypes PRIVATE cxx_std_17 cuda_std_17) + set_target_properties(alignedTypes PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt b/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt index 7e3346b1..64cddd30 100644 --- a/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt +++ b/Samples/6_Performance/cudaGraphsPerfScaling/CMakeLists.txt @@ -1,11 +1,25 @@ +cmake_minimum_required(VERSION 3.20) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") + +project(cudaGraphsPerfScaling LANGUAGES C CXX CUDA) + +find_package(CUDAToolkit REQUIRED) + +set(CMAKE_CUDA_ARCHITECTURES "native") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +endif() + # Include directories and libraries include_directories(../../../Common) # Source file -set(SRC_FILES - cudaGraphPerfScaling.cu -) - # Add target for cudaGraphsPerfScaling -add_executable(cudaGraphsPerfScaling ${SRC_FILES}) +add_executable(cudaGraphsPerfScaling cudaGraphPerfScaling.cu) + +target_compile_options(cudaGraphsPerfScaling PRIVATE $<$:--extended-lambda>) + +target_compile_features(cudaGraphsPerfScaling PRIVATE cxx_std_17 cuda_std_17) + set_target_properties(cudaGraphsPerfScaling PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/Samples/6_Performance/transpose/CMakeLists.txt b/Samples/6_Performance/transpose/CMakeLists.txt index 6d47de1e..774c5c1d 100644 --- a/Samples/6_Performance/transpose/CMakeLists.txt +++ b/Samples/6_Performance/transpose/CMakeLists.txt @@ -1,11 +1,25 @@ +cmake_minimum_required(VERSION 3.20) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") + +project(transpose LANGUAGES C CXX CUDA) + +find_package(CUDAToolkit REQUIRED) + +set(CMAKE_CUDA_ARCHITECTURES "native") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive) +endif() + # Include directories and libraries include_directories(../../../Common) # Source file -set(SRC_FILES - transpose.cu -) - # Add target for transpose -add_executable(transpose ${SRC_FILES}) +add_executable(transpose transpose.cu) + +target_compile_options(transpose PRIVATE $<$:--extended-lambda>) + +target_compile_features(transpose PRIVATE cxx_std_17 cuda_std_17) + set_target_properties(transpose PROPERTIES CUDA_SEPARABLE_COMPILATION ON)