Skip to content

Commit

Permalink
Add debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
ldorau committed Dec 19, 2024
1 parent 4136144 commit 05f5666
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions source/adapters/cuda/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
}

try {
fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i)\n",
__LINE__);
umf_cuda_memory_provider_params_handle_t cu_memory_provider_params =
nullptr;
umf_result_t umf_result =
Expand All @@ -127,6 +130,10 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
throw Result;
}

fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"NumDevices=%i)\n",
__LINE__, NumDevices);
for (int i = 0; i < NumDevices; ++i) {
ur_device_handle_t_ *device_handle = Platform.Devices[i].get();
CUdevice device = device_handle->get();
Expand Down Expand Up @@ -156,20 +163,40 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
}

umf_memory_provider_handle_t umfCUDAprovider = nullptr;
fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"i=%i, NumDevices=%i)\n",
__LINE__, i, NumDevices);
umf_result = umfMemoryProviderCreate(umfCUDAMemoryProviderOps(),
cu_memory_provider_params,
&umfCUDAprovider);
fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"i=%i, NumDevices=%i)\n",
__LINE__, i, NumDevices);
if (umf_result != UMF_RESULT_SUCCESS) {
Result = umf::umf2urResult(umf_result);
throw Result;
}

fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"i=%i, NumDevices=%i)\n",
__LINE__, i, NumDevices);
device_handle->setUmfCUDAprovider(
(umf_usm_memory_type_t)memType, umfCUDAprovider);
}
}

fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"NumDevices=%i)\n",
__LINE__, NumDevices);
umfCUDAMemoryProviderParamsDestroy(cu_memory_provider_params);
fprintf(stderr,
"DEBUG_UMF >>> Creating CUDA memory provider (line %i, "
"NumDevices=%i)\n",
__LINE__, NumDevices);
} catch (ur_result_t Err) {
Result = Err;
throw Err;
Expand Down

0 comments on commit 05f5666

Please sign in to comment.