Skip to content

Commit 57d4a6d

Browse files
committed
setting gpu device globally
1 parent f52fd50 commit 57d4a6d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

content/cupy.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ For example, the following code snippet creates an array on GPU 1:
175175
>>> print("x_gpu1 is on device:" x_gpu1.device)
176176
```
177177

178+
Sometimes it is more convenient to set the device globally:
179+
```
180+
>>> import cupy as cp
181+
>>> cp.cuda.runtime.setDevice(1)
182+
```
183+
178184
All CuPy operations (except for multi-GPU features
179185
and device-to-device copy) are performed
180186
on the currently active device.

0 commit comments

Comments
 (0)