fix cupy.ndarray.get()/set() always use GPU#0 even when the array is on other than GPU#0
@@ -1380,6 +1380,7 @@ cdef class ndarray:
a_gpu = self
a_cpu = numpy.empty(self._shape, dtype=self.dtype, order=order)
ptr = ctypes.c_void_p(a_cpu.__array_interface__['data'][0])
+ with self.device:
if stream is not None:
a_gpu.data.copy_to_host_async(ptr, a_gpu.nbytes, stream)
else:
@@ -1417,6 +1418,7 @@ cdef class ndarray:
raise RuntimeError('Cannot set to non-contiguous array')
ptr = ctypes.c_void_p(arr.__array_interface__['data'][0])
+ with self.device:
if stream is not None:
self.data.copy_from_host_async(ptr, self.nbytes, stream)
else:
