mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-11-18 01:48:16 +08:00
Post v13.5 (#470)
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/Modules")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/DetectCudaArch.cmake")
|
||||
|
||||
if(SAMPLE_SKIP_BUILD)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(localityDomains LANGUAGES C CXX CUDA)
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/CudaSampleCommon.cmake")
|
||||
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
|
||||
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()
|
||||
|
||||
# Source file
|
||||
# Add target for localityDomains
|
||||
add_executable(localityDomains localityDomains.cu)
|
||||
@@ -27,5 +25,5 @@ target_compile_features(localityDomains PRIVATE cxx_std_17 cuda_std_17)
|
||||
set_target_properties(localityDomains PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
|
||||
# Include installation configuration
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/InstallSamples.cmake)
|
||||
include(InstallSamples)
|
||||
setup_samples_install()
|
||||
|
||||
@@ -72,7 +72,7 @@ allocation 0x<address> is localized to locality domain 0
|
||||
...
|
||||
```
|
||||
|
||||
If device 0 does not support memory pools, the sample reports that it is waiving execution and exits with status EXIT_WAIVED.
|
||||
If device 0 does not support memory pools or reports no locality domains, the sample reports that it is waiving execution and exits with status 2 (waived). A successful run exits with status 0.
|
||||
|
||||
## Files
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ int main()
|
||||
|
||||
if (!memoryPoolsSupported) {
|
||||
std::cout << "Waiving execution as the device does not support memory pools." << std::endl;
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Device information
|
||||
@@ -65,6 +65,11 @@ int main()
|
||||
std::cout << "SMs per locality domain: " << localityDomainSmCount << std::endl;
|
||||
}
|
||||
|
||||
if (localityDomainCount == 0) {
|
||||
std::cout << "Waiving execution as the device does not support locality domains." << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Construct localized green contexts and streams
|
||||
std::vector<cudaExecutionContext_t> greenContexts(localityDomainCount);
|
||||
std::vector<cudaStream_t> streams(localityDomainCount);
|
||||
|
||||
Reference in New Issue
Block a user