You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/process.mdx
+23-10Lines changed: 23 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,24 +351,37 @@ Multiprocessing significantly speeds up processing by parallelizing processes on
351
351
The [`~Dataset.map`] also works with the rank of the process if you set `with_rank=True`. This is analogous to the `with_indices` parameter. The `with_rank` parameter in the mapped function goes after the `index` one if it is already present.
352
352
353
353
```py
354
-
>>>from multiprocess import set_start_method
355
354
>>>import torch
356
-
>>>import os
357
-
>>>
358
-
>>>for i inrange(torch.cuda.device_count()): # send model to every GPU
...num_proc=torch.cuda.device_count(), # one process per GPU
382
+
...batched=True, # optional
383
+
...batch_size=8, # optional
384
+
... )
372
385
```
373
386
374
387
The main use-case for rank is to parallelize computation across several GPUs. This requires setting `multiprocess.set_start_method("spawn")`. If you don't you'll receive the following CUDA error:
0 commit comments