@@ -314,7 +314,7 @@ Tensor& add_out_dense_sparse_cuda(Tensor& r_, const Tensor& dense, const SparseT
314314 const dim3 block = cuda::getApplyBlock ();
315315 dim3 grid;
316316 int curDevice = -1 ;
317- cudaGetDevice (&curDevice);
317+ c10::cuda::GetDevice (&curDevice);
318318 cudaStream_t stream = at::cuda::getCurrentCUDAStream (curDevice);
319319 if (sparse.dense_dim () == 0 ) {
320320 TORCH_CHECK (cuda::getApplyGrid (nnz, grid, curDevice), " add: Argument #0: tensor too large or too many dimensions" );
@@ -606,7 +606,7 @@ Tensor _sparse_sum_backward_cuda(const Tensor& grad_, const SparseTensor& input_
606606 }
607607 else {
608608 int curDevice = -1 ;
609- cudaGetDevice (&curDevice);
609+ c10::cuda::GetDevice (&curDevice);
610610 cudaStream_t stream = at::cuda::getCurrentCUDAStream (curDevice);
611611 at::cuda::ThrustAllocator allocator;
612612 auto policy = thrust::cuda::par (allocator).on (stream);
@@ -711,7 +711,7 @@ __global__ void search_end_matrix_indices_cuda_kernel(
711711// indices to find the end index for each matrix
712712void search_end_matrix_indices (int64_t * mat_el_end_indices, int64_t num_matrices, const Tensor& indices_1D) {
713713 int curDevice = -1 ;
714- cudaGetDevice (&curDevice);
714+ c10::cuda::GetDevice (&curDevice);
715715 cudaStream_t stream = at::cuda::getCurrentCUDAStream (curDevice);
716716
717717 auto indices_1D_ti = getTensorInfo<int64_t , int64_t >(indices_1D);
0 commit comments