Skip to content

Commit 75d7b10

Browse files
minor: change device selection in mdd_cupy.py
Co-authored-by: Rohan Babbar <[email protected]>
1 parent 66872d0 commit 75d7b10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tutorials_cupy/mdd_cupy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
size = MPI.COMM_WORLD.Get_size()
2424
dtype = np.float32
2525
cdtype = np.complex64
26-
cp.cuda.Device(device=rank).use();
26+
device_count = cp.cuda.runtime.getDeviceCount()
27+
cp.cuda.Device(rank % device_count).use()
2728

2829
###############################################################################
2930
# Let's start by creating a set of hyperbolic events to be used as

0 commit comments

Comments
 (0)