Giter VIP home page Giter VIP logo

ray_tutorial's Introduction

A Guided Tour of Ray Core

An introductory tutorial about leveraging Ray core features for distributed patterns.

These examples have been tested in the following environments:

  • Ubuntu 18.04 LTS
  • macOS 11.6, Big Sur

Using:

  • Ray versions 1.7+
  • Python versions: 3.6, 3.7, 3.8

See the slides.pdf file for the presentation slide deck that accompanies this tutorial.

Getting Started

To get started use git to clone this public repository:

git clone https://github.com/DerwenAI/ray_tutorial.git
cd ray_tutorial

Getting Started with a Virtual Environment

Set up a local virtual environment and activate it:

python3 -m venv venv
source venv/bin/activate

Then use pip to install the required dependencies:

python3 -m pip install -U pip
python3 -m pip install -r requirements.txt
python3 -m ipykernel install

Alternatively, if you use conda for installing Python packages:

conda create -n ray_tutorial python=3.7
conda activate ray_tutorial
python3 -m pip install -r requirements.txt
conda install ipykernel --name Python3

Note: if you run into any problems on Python 3.8 with "wheels" during a pip installation, you may need to use the conda approach instead.

For some of the visualizations in pi.ipynb you also need to install graphviz

Then launch the JupyterLab environment to run examples in this repo:

jupyter-lab

Browse to http://localhost:8888/lab to continue.

Getting started with Docker-Compose

First, install docker and docker-compose, then:

docker-compose up -d

Docker compose will start a JupyterLab service without requiring use of a security token.

Browse to http://localhost:8888/lab to continue.

To stop this container:

docker-compose stop

Syllabus

Overview

A Guided Tour of Ray Core covers an introductory, hands-on coding tour through the core features of Ray, which provide powerful yet easy-to-use design patterns for implementing distributed systems in Python. This training includes a brief talk to provide overview of concepts, then coding for remote functions, tasks, object references and resolutions, actors, and so on.

Then we'll follow with Q&A. All code is available in notebooks in the GitHub repo.

Intended Audience

  • Python developers who want to learn how to parallelize their application code

Note: this material is not intended as an introduction to the higher level components in Ray, such as RLlib and Ray Tune.

Prerequisites

  • Some prior experience developing code in Python
  • Basic understanding of distributed systems

Key Takeaways

  • What are the Ray core features and how to use them?
  • In which contexts are the different approaches indicated?
  • Profiling methods, to decide when to make trade-offs (compute cost, memory, I/O, etc.) ?

Course Outline

  1. Introduction to Ray core features as a pattern language for distributed systems
  2. Overview of the main Ray core features and their intended usage
  3. Background, primary sources, and closely related resources about distributed systems
  4. Code samples:
  5. Profiling: comparing trade-offs and overhead
  6. Ray Summit, Anyscale Connect, developer forums, and other resources
  7. Q&A

Other Recommended Reading

Kudos

@dmatrix, @penolove, @deanwampler, @ceteri.

ray_tutorial's People

Contributors

ceteri avatar dmatrix avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ray_tutorial's Issues

Information: Firewall needs to be turned off on mac

Hello,

Creating documentation and if this helps others when playing with ray:

On Macbook the firewall needs to be turned off so that the distributed components like Redis and ray processes can talk to each other, To turn off the firewall go to, System Preferences -> security & privacy -> Firewall.

Adding the screenshot of manual accept messages that I was getting repeatedly:
Screen Shot 2021-03-22 at 9 55 06 AM

Error in the install process.

Hi, was walking thru the tutorial and came across this:

$ python3 -m pip install -r requirements.txt
Collecting yarl==1.4.2
  Using cached yarl-1.4.2.tar.gz (163 kB)
Collecting multidict==4.7.3
  Using cached multidict-4.7.3.tar.gz (50 kB)
Collecting graphviz>=0.14
  Using cached graphviz-0.16-py2.py3-none-any.whl (19 kB)
Collecting icecream>=1.2
  Using cached icecream-2.1.0-py2.py3-none-any.whl (8.0 kB)
Collecting jupyterlab>=3.0
  Using cached jupyterlab-3.0.12-py3-none-any.whl (8.3 MB)
Collecting matplotlib>=3.3
  Using cached matplotlib-3.3.4-cp36-cp36m-macosx_10_9_x86_64.whl (8.5 MB)
**ERROR: Could not find a version that satisfies the requirement numpy>=1.20
ERROR: No matching distribution found for numpy>=1.20**

Cannot install ray on Python 3.9.2

I created a container based on the python:3.9-buster image to run the notebooks.

After cloning the repo into the container and moving to the repo's root folder, I ran the following commands:

python -m venv venv
source venv/bin/activate
python3 -m pip install -U pip
python3 -m pip install -r requirements.txt

The last command threw the following error:

ERROR: Could not find a version that satisfies the requirement ray>=1.2
ERROR: No matching distribution found for ray>=1.2

Using the python:3.7-buster and python:3.8-buster image which comes with python 3.7.10 and python 3.8.9 respectively works fine.

Mention dependency on Graphviz executable in Getting Started?

I followed the installation instructions using pip on Python 3.7.

This part of the pi.ipynb notebook:

roots = objgraph.get_leaking_objects()
objgraph.show_refs(roots[:3], refcounts=True)

threw the following exception:

ExecutableNotFound: failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH

I think we should add getting the graphviz executable as part of the installation process. On ubuntu, it's:

sudo apt install graphviz

the steps to get the executable on other platforms is here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.