ray/doc/source/using-ray.rst

30 lines
1,011 B
ReStructuredText
Raw Normal View History

Using Ray
=========
If youre brand new to Ray, we recommend starting with our `tutorials <https://github.com/ray-project/tutorial>`_.
Below, you'll find information ranging from how to `start Ray <starting-ray.html>`_ to `advanced usage <advanced.html>`_. There are also detailed instructions on how to work with Ray concepts such as Actors and managing GPUs.
Finally, we've also included some content on using core Ray APIs with `Tensorflow <using-ray-with-tensorflow.html>`_, `PyTorch <using-ray-with-pytorch.html>`_ and `Jupyter Notebook <using-ray-with-jupyter.rst>`_.
.. toctree::
:maxdepth: -1
starting-ray.rst
actors.rst
2021-05-17 10:04:22 -07:00
namespaces.rst
handling-dependencies.rst
async_api.rst
[Core] Port concurrency groups with asyncio (#18567) ## Why are these changes needed? This PR aims to port concurrency groups functionality with asyncio for Python. ### API ```python @ray.remote(concurrency_groups={"io": 2, "compute": 4}) class AsyncActor: def __init__(self): pass @ray.method(concurrency_group="io") async def f1(self): pass @ray.method(concurrency_group="io") def f2(self): pass @ray.method(concurrency_group="compute") def f3(self): pass @ray.method(concurrency_group="compute") def f4(self): pass def f5(self): pass ``` The annotation above the actor class `AsyncActor` defines this actor will have 2 concurrency groups and defines their max concurrencies, and it has a default concurrency group. Every concurrency group has an async eventloop and a pythread to execute the methods which is defined on them. Method `f1` will be invoked in the `io` concurrency group. `f2` in `io`, `f3` in `compute` and etc. TO BE NOTICED, `f5` and `__init__` will be invoked in the default concurrency. The following method `f2` will be invoked in the concurrency group `compute` since the dynamic specifying has a higher priority. ```python a.f2.options(concurrency_group="compute").remote() ``` ### Implementation The straightforward implementation details are: - Before we only have 1 eventloop binding 1 pythread for an asyncio actor. Now we create 1 eventloop binding 1 pythread for every concurrency group of the asyncio actor. - Before we have 1 fiber state for every caller in the asyncio actor. Now we create a FiberStateManager for every caller in the asyncio actor. And the FiberStateManager manages the fiber states for concurrency groups. ## Related issue number #16047
2021-10-21 21:46:56 +08:00
concurrency_group_api.rst
using-ray-with-gpus.rst
serialization.rst
memory-management.rst
placement-group.rst
troubleshooting.rst
fault-tolerance.rst
advanced.rst
2020-09-08 16:51:40 +08:00
cross-language.rst
using-ray-with-tensorflow.rst
using-ray-with-pytorch.rst
using-ray-with-jupyter.rst