Skip to content

Commit 72e6d01

Browse files
authored
Find Thrust + fix compilation on CUDA13 (#14801)
* Find Thrust in CUDA13 * Fix compatibility with CUDA13 * Update FindO2GPU.cmake version to 5
1 parent 02b8c0d commit 72e6d01

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
120120

121121
if (mMaster == nullptr) {
122122
cudaDeviceProp deviceProp;
123+
int deviceMemoryClockRate{0}, deviceClockRate{0};
123124
int32_t count, bestDevice = -1;
124125
double bestDeviceSpeed = -1, deviceSpeed;
125126
if (GPUChkErrI(cudaGetDeviceCount(&count))) {
@@ -153,7 +154,9 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
153154
if (GetProcessingSettings().debugLevel >= 4) {
154155
GPUInfo("Obtained current memory usage for device %d", i);
155156
}
156-
if (GPUChkErrI(cudaGetDeviceProperties(&deviceProp, i))) {
157+
if (GPUChkErrI(cudaGetDeviceProperties(&deviceProp, i)) ||
158+
GPUChkErrI(cudaDeviceGetAttribute(&deviceMemoryClockRate, cudaDevAttrMemoryClockRate, i)) ||
159+
GPUChkErrI(cudaDeviceGetAttribute(&deviceClockRate, cudaDevAttrClockRate, i))) {
157160
continue;
158161
}
159162
if (GetProcessingSettings().debugLevel >= 4) {
@@ -172,7 +175,7 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
172175
deviceFailure = "Insufficient GPU memory";
173176
}
174177

175-
deviceSpeed = (double)deviceProp.multiProcessorCount * (double)deviceProp.clockRate * (double)deviceProp.warpSize * (double)free * (double)deviceProp.major * (double)deviceProp.major;
178+
deviceSpeed = (double)deviceProp.multiProcessorCount * (double)deviceClockRate * (double)deviceProp.warpSize * (double)free * (double)deviceProp.major * (double)deviceProp.major;
176179
if (GetProcessingSettings().debugLevel >= 2) {
177180
GPUImportant("Device %s%2d: %s (Rev: %d.%d - Mem Avail %lu / %lu)%s %s", deviceOK ? " " : "[", i, deviceProp.name, deviceProp.major, deviceProp.minor, free, (size_t)deviceProp.totalGlobalMem, deviceOK ? " " : " ]", deviceOK ? "" : deviceFailure);
178181
}
@@ -239,8 +242,8 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
239242
GPUInfo("\ttotalConstMem = %ld", (uint64_t)deviceProp.totalConstMem);
240243
GPUInfo("\tmajor = %d", deviceProp.major);
241244
GPUInfo("\tminor = %d", deviceProp.minor);
242-
GPUInfo("\tclockRate = %d", deviceProp.clockRate);
243-
GPUInfo("\tmemoryClockRate = %d", deviceProp.memoryClockRate);
245+
GPUInfo("\tclockRate = %d", deviceClockRate);
246+
GPUInfo("\tdeviceMemoryClockRateRate = %d", deviceMemoryClockRate);
244247
GPUInfo("\tmultiProcessorCount = %d", deviceProp.multiProcessorCount);
245248
GPUInfo("\ttextureAlignment = %ld", (uint64_t)deviceProp.textureAlignment);
246249
GPUInfo(" ");
@@ -371,7 +374,7 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
371374
#endif
372375
mDeviceConstantMem = (GPUConstantMem*)devPtrConstantMem;
373376

374-
GPUInfo("CUDA Initialisation successfull (Device %d: %s (Frequency %d, Cores %d), %ld / %ld bytes host / global memory, Stack frame %d, Constant memory %ld)", mDeviceId, deviceProp.name, deviceProp.clockRate, deviceProp.multiProcessorCount, (int64_t)mHostMemorySize, (int64_t)mDeviceMemorySize, (int32_t)GPUCA_GPU_STACK_SIZE, (int64_t)gGPUConstantMemBufferSize);
377+
GPUInfo("CUDA Initialisation successfull (Device %d: %s (Frequency %d, Cores %d), %ld / %ld bytes host / global memory, Stack frame %d, Constant memory %ld)", mDeviceId, deviceProp.name, deviceClockRate, deviceProp.multiProcessorCount, (int64_t)mHostMemorySize, (int64_t)mDeviceMemorySize, (int32_t)GPUCA_GPU_STACK_SIZE, (int64_t)gGPUConstantMemBufferSize);
375378
} else {
376379
GPUReconstructionCUDA* master = dynamic_cast<GPUReconstructionCUDA*>(mMaster);
377380
mDeviceId = master->mDeviceId;

dependencies/FindO2GPU.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# or submit itself to any jurisdiction.
1111

1212
# NOTE!!!! - Whenever this file is changed, move it over to alidist/resources
13-
# FindO2GPU.cmake Version 4
13+
# FindO2GPU.cmake Version 5
1414

1515
if(NOT DEFINED ENABLE_CUDA)
1616
set(ENABLE_CUDA "AUTO")
@@ -139,10 +139,14 @@ if(ENABLE_CUDA)
139139
message(${FAILURE_SEVERITY} "CUDA was found but cannot be enabled")
140140
set(CMAKE_CUDA_COMPILER OFF)
141141
endif()
142-
find_path(THRUST_INCLUDE_DIR thrust/version.h PATHS ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} NO_DEFAULT_PATH)
142+
find_path(THRUST_INCLUDE_DIR thrust/version.h PATHS ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
143+
PATH_SUFFIXES "" cccl
144+
NO_DEFAULT_PATH)
143145
if(THRUST_INCLUDE_DIR STREQUAL "THRUST_INCLUDE_DIR-NOTFOUND")
144-
message(${FAILURE_SEVERITY} "CUDA found but thrust not available")
146+
message(${FAILURE_SEVERITY} "CUDA found but thrust not available, looked under: ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
145147
set(CMAKE_CUDA_COMPILER OFF)
148+
else()
149+
message(STATUS "Thrust found in the path: ${THRUST_INCLUDE_DIR}")
146150
endif()
147151
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "12.8")
148152
message(${FAILURE_SEVERITY} "CUDA Version too old: ${CMAKE_CUDA_COMPILER_VERSION}, 12.8 required")

0 commit comments

Comments
 (0)