Skip to content

Commit

Permalink
GPU: Add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrohr committed Oct 7, 2024
1 parent 7380cae commit 9e6bd6d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,19 @@ int GPUReconstructionCUDA::InitDevice_Runtime()
mDeviceMemorySize = mDeviceMemorySize * 2 / 3; // Leave 1/3 of GPU memory for event display
}

if (mProcessingSettings.debugLevel >= 3) {
GPUInfo("Allocating memory on GPU");
}
if (mDeviceMemorySize > deviceProp.totalGlobalMem || GPUFailedMsgI(cudaMalloc(&mDeviceMemoryBase, mDeviceMemorySize))) {
size_t free, total;
GPUFailedMsg(cudaMemGetInfo(&free, &total));
GPUError("CUDA Memory Allocation Error (trying %lld bytes, %lld available on GPU, %lld free)", (long long int)mDeviceMemorySize, (long long int)deviceProp.totalGlobalMem, (long long int)free);
GPUFailedMsgI(cudaDeviceReset());
return (1);
}
if (mProcessingSettings.debugLevel >= 3) {
GPUInfo("Allocating memory on Host");
}
if (GPUFailedMsgI(cudaMallocHost(&mHostMemoryBase, mHostMemorySize))) {
GPUError("Error allocating Page Locked Host Memory (trying %lld bytes)", (long long int)mHostMemorySize);
GPUFailedMsgI(cudaDeviceReset());
Expand Down Expand Up @@ -611,6 +617,9 @@ int GPUReconstructionCUDA::GPUDebug(const char* state, int stream, bool force)

int GPUReconstructionCUDA::registerMemoryForGPU_internal(const void* ptr, size_t size)
{
if (mProcessingSettings.debugLevel >= 3) {
GPUInfo("Registering %zu bytes of memory for GPU", size);
}
return GPUFailedMsgI(cudaHostRegister((void*)ptr, size, cudaHostRegisterDefault));
}

Expand Down

0 comments on commit 9e6bd6d

Please sign in to comment.