From a9a05d97189e29b63c6c291c65791ae657dfca03 Mon Sep 17 00:00:00 2001 From: Andrei Ivanov Date: Mon, 13 Jan 2025 09:50:51 -0800 Subject: [PATCH 1/2] Replacing soon-to-be-deprecated `lazyInitCUDA` with `lazyInitDevice(at::kCUDA)` --- graphbolt/src/cuda/common.h | 2 +- tensoradapter/pytorch/torch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphbolt/src/cuda/common.h b/graphbolt/src/cuda/common.h index c2ffc719c438..66dedac8ee1c 100644 --- a/graphbolt/src/cuda/common.h +++ b/graphbolt/src/cuda/common.h @@ -58,7 +58,7 @@ 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 CUDAWorkspaceAllocator(CUDAWorkspaceAllocator const&) noexcept {} diff --git a/tensoradapter/pytorch/torch.cpp b/tensoradapter/pytorch/torch.cpp index e02b02e46dda..3e410f01c7ba 100644 --- a/tensoradapter/pytorch/torch.cpp +++ b/tensoradapter/pytorch/torch.cpp @@ -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); } From effd905bf43793d47aa31cde3e8384d3dbab06cb Mon Sep 17 00:00:00 2001 From: Andrei Ivanov Date: Mon, 13 Jan 2025 10:26:43 -0800 Subject: [PATCH 2/2] Fixing Lint issue --- graphbolt/src/cuda/common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphbolt/src/cuda/common.h b/graphbolt/src/cuda/common.h index 66dedac8ee1c..b18258a1dbb6 100644 --- a/graphbolt/src/cuda/common.h +++ b/graphbolt/src/cuda/common.h @@ -58,7 +58,9 @@ struct CUDAWorkspaceAllocator { // Required by thrust to satisfy allocator requirements. using value_type = value_t; - explicit CUDAWorkspaceAllocator() { at::globalContext().lazyInitDevice(at::kCUDA); } + explicit CUDAWorkspaceAllocator() { + at::globalContext().lazyInitDevice(at::kCUDA); + } template CUDAWorkspaceAllocator(CUDAWorkspaceAllocator const&) noexcept {}