[DeprecationWarning] Replacing soon-to-be-deprecated lazyInitCUDA with lazyInitDevice(at::kCUDA) (#7855)

This commit is contained in:
Andrei Ivanov
2025-01-15 17:53:23 -08:00
committed by GitHub
parent 17017c2899
commit ba731332bd
2 changed files with 4 additions and 2 deletions

View File

@@ -58,7 +58,9 @@ struct CUDAWorkspaceAllocator {
// Required by thrust to satisfy allocator requirements.
using value_type = value_t;
explicit CUDAWorkspaceAllocator() { at::globalContext().lazyInitCUDA(); }
explicit CUDAWorkspaceAllocator() {
at::globalContext().lazyInitDevice(at::kCUDA);
}
template <class U>
CUDAWorkspaceAllocator(CUDAWorkspaceAllocator<U> const&) noexcept {}

View File

@@ -28,7 +28,7 @@ TA_EXPORTS void CPURawDelete(void* ptr) {
#ifdef DGL_USE_CUDA
TA_EXPORTS void* CUDARawAlloc(size_t nbytes, cudaStream_t stream) {
at::globalContext().lazyInitCUDA();
at::globalContext().lazyInitDevice(at::kCUDA);
return c10::cuda::CUDACachingAllocator::raw_alloc_with_stream(nbytes, stream);
}