Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit 83029f9

Browse files
author
Jules S.Damji
committed
modified the README.md to update with 1.8, removed deprecated ParallelIterators notebook, added a new notebook as part of remote functions
Signed-off-by: Jules S.Damji <jules@anyscale.com>
1 parent af831f9 commit 83029f9

7 files changed

Lines changed: 303 additions & 493 deletions

File tree

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ core features for distributed patterns.
66
These examples have been tested in the following environments:
77

88
- Ubuntu 18.04 LTS
9-
- macOS 10.15
9+
- macOS 11.6, Big Sur
1010

1111
Using:
1212

13-
- Ray versions 1.2, 1.3, 1.4 (not the early release candidates)
13+
- Ray versions 1.7+ (not the early release candidates)
1414
- Python versions: 3.6, 3.7, 3.8
1515

1616
Currently, Python **3.9** is not supported by Ray.
@@ -70,9 +70,10 @@ Browse to <http://localhost:8888/lab> to continue.
7070
tour through the core features of Ray, which provide powerful yet
7171
easy-to-use design patterns for implementing distributed systems in
7272
Python. This training includes a brief talk to provide overview of
73-
concepts, then coding for remote functions, actors, parallel
74-
iterators, and so on. Then we'll follow with Q&A. All code is
75-
available in notebooks in the GitHub repo.
73+
concepts, then coding for remote functions, tasks, object references and
74+
resolutions, actors, and so on.
75+
76+
Then we'll follow with Q&A. All code is available in notebooks in the GitHub repo.
7677

7778
### Intended Audience
7879

@@ -99,11 +100,11 @@ level components in Ray, such as RLlib and Ray Tune.
99100
3. Background, primary sources, and closely related resources about distributed systems
100101
4. Code samples:
101102
* Remote Functions: [`ex_01_remo_func.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_01_remo_func.ipynb)
103+
* Remote Functions: [`ex_02_remo_func.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_02_remo_func.ipynb)
102104
* Remote Objects: [`ex_02_remo_objs.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_02_remo_objs.ipynb)
103105
* Remote Methods: [`ex_03_remo_meth.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_03_remo_meth.ipynb)
104106
* Multiprocessing Pool: [`ex_04_mult_pool.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_04_mult_pool.ipynb)
105107
* JobLib: [`ex_05_job_lib.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_05_job_lib.ipynb)
106-
* Parallel Iterators: [`ex_06_para_iter.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/ex_06_para_iter.ipynb)
107108
5. Profiling: comparing trade-offs and overhead
108109
* Estimate Pi: [`pi.ipynb`](https://github.com/DerwenAI/ray_tutorial/blob/main/pi.ipynb)
109110
6. Ray Summit, Anyscale Connect, developer forums, and other resources

dat/file_1.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
0, 48, 72, 75, 54, 89, 84, 68, 9, 38
2+
3, 40, 73, 58, 10, 35, 96, 6, 65, 33
3+
55, 67, 12, 97, 52, 73, 7, 76, 39, 50
4+
59, 34, 20, 40, 92, 55, 11, 39, 93, 38
5+
89, 89, 37, 52, 48, 86, 49, 3, 19, 50
6+
84, 37, 68, 11, 20, 36, 46, 61, 52, 77
7+
70, 90, 56, 55, 49, 76, 94, 28, 32, 23
8+
5, 44, 92, 15, 53, 63, 87, 75, 61, 25
9+
51, 58, 29, 30, 93, 94, 52, 72, 80, 27
10+
1, 28, 82, 35, 89, 36, 10, 84, 85, 65

dat/file_2.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
101, 31, 83,124, 41, 73, 0,121, 14, 98
2+
137, 3, 77, 38,117, 79,104, 96, 62,117
3+
99, 92,139, 29, 59, 30,116, 30, 74, 12
4+
130,105,145,124, 39, 50, 66, 9,126, 24
5+
32, 33, 34, 90, 43,140,136,149,140, 22
6+
14, 8,138,101,136, 60, 41,110, 92,105
7+
44, 76,104, 6,121,135, 41,132,131, 26
8+
1, 1,112, 45,146, 29, 44,104, 75,122
9+
132, 63, 70,109, 49, 75, 33, 36, 38,105
10+
131, 71, 51, 79,109,146, 71, 27, 65,126

ex_01_remo_func.ipynb

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"cell_type": "markdown",
2424
"metadata": {},
2525
"source": [
26-
"First, let's start Ray…"
26+
"First, let's start Ray… \n",
27+
"\n",
28+
"This will start Ray on the local host, with headnode and workers for each core or CPU available.\n",
29+
"You can check the resources being used."
2730
]
2831
},
2932
{
@@ -38,7 +41,15 @@
3841
"ray.init(\n",
3942
" ignore_reinit_error=True, # Don't print error messages if a Ray instance is already running. Attach to it\n",
4043
" logging_level=logging.ERROR, \n",
41-
")"
44+
")\n",
45+
"ray.cluster_resources() # get the cluster resources"
46+
]
47+
},
48+
{
49+
"cell_type": "markdown",
50+
"metadata": {},
51+
"source": [
52+
"Ray Dashboard accessible at URI: [http://127.0.0.1:8265](http://127.0.0.1:8265)"
4253
]
4354
},
4455
{
@@ -129,7 +140,7 @@
129140
"cell_type": "markdown",
130141
"metadata": {},
131142
"source": [
132-
"The result can be retrieved with `ray.get`"
143+
"The result can be retrieved with `ray.get`, which is a blocking call if the task is still not finished"
133144
]
134145
},
135146
{
@@ -147,7 +158,7 @@
147158
"cell_type": "markdown",
148159
"metadata": {},
149160
"source": [
150-
"Invocations of Ray *remote functions* happen in parallel, and all computation gets performed in the background, driven by Ray's internal event loop.\n",
161+
"Invocations of Ray *remote functions* happen in parallel, and all computation gets performed in the background, driven by Ray's internal event loop. Remote calls return immediately, with a Python Future Object reference.\n",
151162
"\n",
152163
"To illustrate this, first let's define a relatively \"slow\" function, by adding a 10 second delay..."
153164
]
@@ -187,7 +198,6 @@
187198
"for i in range(4):\n",
188199
" future = slow_function.remote()\n",
189200
" futures_list.append(future)\n",
190-
" print(i)\n",
191201
"print(futures_list)"
192202
]
193203
},
@@ -210,6 +220,45 @@
210220
"Note the difference between CPU times and wall clock?"
211221
]
212222
},
223+
{
224+
"cell_type": "markdown",
225+
"metadata": {},
226+
"source": [
227+
"## Another way to do this is using list comprehension"
228+
]
229+
},
230+
{
231+
"cell_type": "code",
232+
"execution_count": null,
233+
"metadata": {},
234+
"outputs": [],
235+
"source": [
236+
"%%time\n",
237+
"\n",
238+
"futures_list = [slow_function.remote() for _ in range(4)]\n",
239+
"futures_list"
240+
]
241+
},
242+
{
243+
"cell_type": "code",
244+
"execution_count": null,
245+
"metadata": {},
246+
"outputs": [],
247+
"source": [
248+
"%%time\n",
249+
"\n",
250+
"values_list = [ray.get(future) for future in futures_list]\n",
251+
"values_list"
252+
]
253+
},
254+
{
255+
"cell_type": "markdown",
256+
"metadata": {},
257+
"source": [
258+
"Note the difference between CPU times and wall clock in comprehensions? \n",
259+
"Comprehensions seems faster."
260+
]
261+
},
213262
{
214263
"cell_type": "markdown",
215264
"metadata": {},
@@ -240,13 +289,16 @@
240289
"source": [
241290
"[*Patterns for Parallel Programming*](https://www.goodreads.com/book/show/85053.Patterns_for_Parallel_Programming) \n",
242291
"Timothy G. Mattson, Beverly A. Sanders, Berna L. Massingill \n",
243-
"Addison-Wesley (2004)"
292+
"Addison-Wesley (2004)\n",
293+
"\n",
294+
"[Ray Core Walkthrough](https://docs.ray.io/en/latest/walkthrough.html)\n",
295+
"Ray Documentation and Gettting started materials"
244296
]
245297
}
246298
],
247299
"metadata": {
248300
"kernelspec": {
249-
"display_name": "Python 3",
301+
"display_name": "Python 3 (ipykernel)",
250302
"language": "python",
251303
"name": "python3"
252304
},
@@ -260,7 +312,7 @@
260312
"name": "python",
261313
"nbconvert_exporter": "python",
262314
"pygments_lexer": "ipython3",
263-
"version": "3.8.8"
315+
"version": "3.7.11"
264316
}
265317
},
266318
"nbformat": 4,

0 commit comments

Comments
 (0)