Skip to content

Commit 1491070

Browse files
author
Your Name
committed
add gpu device check
1 parent abd13e2 commit 1491070

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ void declare_cholesky(nb::module_ &m, const std::string &typestr, const char *do
4747
if (ii.device_type() == nb::device::cuda::value) {
4848
// GPU init
4949
// Initialize CUDA and load the kernels if not already done
50+
if (ii.device_id() != jj.device_id() || ii.device_id() != deviceID)
51+
throw std::invalid_argument("All input tensors should be on the same device!");
52+
5053
init_cuda(deviceID);
5154
CUcontext cu_context = device_contexts[deviceID];
5255

0 commit comments

Comments
 (0)