Skip to content

Commit 1161b1d

Browse files
committed
Fix compatibility with CUDA13
1 parent 43819f6 commit 1161b1d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
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;

0 commit comments

Comments
 (0)