Skip to content

Add Fabric.launch to Fabric methods section #17437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/source-fabric/api/fabric_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@
Fabric Methods
##############

launch
======

With :meth:`~lightning.fabric.fabric.Fabric.launch` you can conveniently launch your script or a function
into multiple processes for distributed training on a single machine.

.. code-block:: python

# Launch the script on 2 devices and init distributed backend
fabric = Fabric(devices=2)
fabric.launch()

The same can be done with code inside a function:

.. code-block:: python

def run(fabric):
# Your distributed code here
...


# Launch a function on 2 devices and init distributed backend
fabric = Fabric(devices=2)
fabric.launch(run)

For example, you can use the latter for multi-GPU training inside a :doc:`Jupyter notebook <../fundamentals/notebooks>`.
For launching distributed training with the CLI, multi-node cluster, or cloud, see :doc:`../fundamentals/launch`.

setup
=====
Expand Down