Skip to content

Commit 66872d0

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tutorials_cupy/lsm_cupy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
plt.close("all")
2424
rank = MPI.COMM_WORLD.Get_rank()
2525
size = MPI.COMM_WORLD.Get_size()
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 with a simple model with two interfaces, where sources are

0 commit comments

Comments
 (0)