mirror of
				https://github.com/NVIDIA/cuda-samples.git
				synced 2025-11-04 15:47:50 +08:00 
			
		
		
		
	Refactor CMakeLists.txt under 6_Performance
This commit is contained in:
		
							parent
							
								
									00999c1789
								
							
						
					
					
						commit
						cbfab74480
					
				@ -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 $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
 | 
			
		||||
target_compile_features(LargeKernelParameter PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
 | 
			
		||||
set_target_properties(LargeKernelParameter PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
 | 
			
		||||
@ -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 $<$<COMPILE_LANGUAGE:CUDA>:--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
 | 
			
		||||
 | 
			
		||||
@ -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 $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
 | 
			
		||||
target_compile_features(alignedTypes PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
 | 
			
		||||
set_target_properties(alignedTypes PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
 | 
			
		||||
@ -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 $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
 | 
			
		||||
target_compile_features(cudaGraphsPerfScaling PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
 | 
			
		||||
set_target_properties(cudaGraphsPerfScaling PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
 | 
			
		||||
@ -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 $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
 | 
			
		||||
target_compile_features(transpose PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
 | 
			
		||||
set_target_properties(transpose PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user