# Ray

- Page: https://shared.btbytes.com/p/ray
- Date: 2024-03-30
- Tags: python, ray, distributed

([Moritz et al. 2018](https://arxiv.org/abs/1712.05889)) [PDF](https://arxiv.org/pdf/1712.05889.pdf)

> Ray unifies task-parallel and actor programming models in a single dynamic task graph and employs a scalable architecture enabled by the global control store and a bottom-up distributed scheduler. The programming flexibility, high throughput, and low latencies simultaneously achieved by this architecture is particularly important for emerging artificial intelligence work- loads, which produce tasks diverse in their resource requirements, duration, and functionality.

[Learning Ray](http://web.archive.org/web/20240811181958/https://assets.ctfassets.net/xjan103pcp94/1lOZBFTziLNrmHTAcgudjb/b791797fcc1cfd4fb5d0aa32692226ea/OReilly-Learning-Ray-Ebook.pdf) by Max Pumperla, Edward Oakes, and Richard Liaw. ( PDF ).

> In short, Ray sets up and manages clusters of computers so that you can run distributed tasks on them. A Ray Cluster consists of nodes that are connected to each other via a network. You program against the so-called driver, the program root, which lives on the head node. The driver can run jobs, a collection of tasks, that are run on the nodes in the cluster. Specifically, the individual tasks of a job are run on worker processes on worker nodes.

This cluster can also be local, on your laptop. The default number of worker processes is the number of CPUs available on your machine.

Github - <https://github.com/ray-project/ray>

<figure>
  <img src="https://github.com/ray-project/ray/raw/master/doc/source/images/what-is-ray-padded.svg" alt=" ">
  <figcaption></figcaption>
</figure>

```
$ pip install "ray[rllib, serve, tune]==2.10.0"

import ray
ray.init()
```

Libraries:

- data processing -- [apache-arrow](https://shared.btbytes.com/p/apache-arrow)
- model training -- TensorFlow, pytorch
- hyperparameter tuning
- model serving

News:

- [Amazon’s Exabyte-Scale Migration from Apache Spark to Ray on Amazon EC2 | AWS Open Source Blog](https://aws.amazon.com/blogs/opensource/amazons-exabyte-scale-migration-from-apache-spark-to-ray-on-amazon-ec2/)

## References

- Moritz, Nishihara, Wang, Tumanov, Liaw, Liang, Elibol, Yang, Paul, Jordan, Stoica (2018). [Ray: A Distributed Framework for Emerging AI Applications](https://arxiv.org/abs/1712.05889).
