Skip to content

Commit 20303e4

Browse files
Add Fabric.launch to Fabric methods section (#17437)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 44ce386 commit 20303e4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/source-fabric/api/fabric_methods.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22
Fabric Methods
33
##############
44

5+
launch
6+
======
7+
8+
With :meth:`~lightning.fabric.fabric.Fabric.launch` you can conveniently launch your script or a function
9+
into multiple processes for distributed training on a single machine.
10+
11+
.. code-block:: python
12+
13+
# Launch the script on 2 devices and init distributed backend
14+
fabric = Fabric(devices=2)
15+
fabric.launch()
16+
17+
The same can be done with code inside a function:
18+
19+
.. code-block:: python
20+
21+
def run(fabric):
22+
# Your distributed code here
23+
...
24+
25+
26+
# Launch a function on 2 devices and init distributed backend
27+
fabric = Fabric(devices=2)
28+
fabric.launch(run)
29+
30+
For example, you can use the latter for multi-GPU training inside a :doc:`Jupyter notebook <../fundamentals/notebooks>`.
31+
For launching distributed training with the CLI, multi-node cluster, or cloud, see :doc:`../fundamentals/launch`.
532

633
setup
734
=====

0 commit comments

Comments
 (0)