Skip to content

Commit

Permalink
[tmp] Instrument cudaMalloc to help figure out why we have non-det fa…
Browse files Browse the repository at this point in the history
…ilures in CI
  • Loading branch information
mbs-octoml committed Aug 11, 2021
1 parent 7827941 commit a5deda2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/runtime/cuda/cuda_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ class CUDADeviceAPI final : public DeviceAPI {
ICHECK_EQ(256 % alignment, 0U) << "CUDA space is aligned at 256 bytes";
void* ret;
if (dev.device_type == kDLCUDAHost) {
LOG(INFO) << "allocating " << nbytes << "bytes on host";
CUDA_CALL(cudaMallocHost(&ret, nbytes));
} else {
CUDA_CALL(cudaSetDevice(dev.device_id));
size_t free_mem, total_mem;
CUDA_CALL(cudaMemGetInfo(&free_mem, &total_mem));
LOG(INFO) << "allocating " << nbytes << " bytes on device, with " << free_mem
<< " bytes currently free out of " << total_mem << " bytes available";
CUDA_CALL(cudaMalloc(&ret, nbytes));
}
return ret;
Expand Down

0 comments on commit a5deda2

Please sign in to comment.