Minor enhancements in julia_distributed notebook.

This commit is contained in:
Francesc Verdugo 2024-08-12 12:40:49 +02:00
parent 0a9199793a
commit a727478b45
3 changed files with 23 additions and 12 deletions

View File

@ -37,7 +37,7 @@
"\n",
"### Creating a task\n",
"\n",
"Technically, a task in Julia is a *symmetric co-routine*. More informally, a task is a piece of computation work that can be started (scheduled) at some point in the future, and that can be interrupted and resumed. To create a task, we first need to create a function that represents the work to be done in the task. In next cell, we generate a task that generates and sums two matrices."
"Technically, a task in Julia is a *symmetric* [*co-routine*](https://en.wikipedia.org/wiki/Coroutine). More informally, a task is a piece of computational work that can be started (scheduled) at some point in the future, and that can be interrupted and resumed. To create a task, we first need to create a function that represents the work to be done in the task. In next cell, we generate a task that generates and sums two matrices."
]
},
{
@ -873,15 +873,15 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.0",
"display_name": "Julia 1.10.0",
"language": "julia",
"name": "julia-1.9"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.0"
"version": "1.10.0"
}
},
"nbformat": 4,

View File

@ -1259,7 +1259,7 @@
},
{
"cell_type": "markdown",
"id": "36969278",
"id": "92248ad5",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",

View File

@ -25,7 +25,7 @@
"source": [
"## Contents\n",
"\n",
"In this notebook, we will learn the basics of distributed computing in Julia. In particular, we will focus on the Distributed module available in the Julia standard library. The main topics we are going to cover are:\n",
"In this notebook, we will learn the basics of distributed computing in Julia. In particular, we will focus on the [Distributed](https://docs.julialang.org/en/v1/manual/distributed-computing/) module available in the Julia standard library. The main topics we are going to cover are:\n",
"\n",
"- How to create Julia processes\n",
"- How to execute code remotely\n",
@ -34,6 +34,16 @@
"With this knowledge you will be able to implement simple and complex parallel algorithms in Julia."
]
},
{
"cell_type": "markdown",
"id": "952e204b",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",
"<b>Tip:</b> We consider the Distributed module as an easy way to start implementing parallel algorithms in this course. Note however that many real-world applications are implemented using MPI, but MPI is harder to learn than Distributed. We will also learn MPI. It will be easier once you have some experience implementing parallel algorithms with Distributed.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "ec225103",
@ -621,8 +631,6 @@
"source": [
"### This will not work!\n",
"\n",
"You really need remote channels to communicate different processes. Standard Channels would not work. For instance, the following code would block at the `take!`. Worker 4 will receive a different copy of the channel and will put values in it. The channel defined in the main process will remain empty and this will make the take! to block. \n",
"\n",
"```julia\n",
"chnl = Channel{Int}()\n",
"@spawnat 4 begin\n",
@ -632,7 +640,10 @@
" close(chnl)\n",
"end\n",
"take!(chnl)\n",
"```"
"```\n",
"\n",
"You really need remote channels to communicate different processes. Standard Channels would not work. For instance, the following code would block at the `take!`. Worker 4 will receive a different copy of the channel and will put values in it. The channel defined in the main process will remain empty and this will make the take! to block. \n",
"\n"
]
},
{
@ -1330,15 +1341,15 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.1",
"display_name": "Julia 1.10.0",
"language": "julia",
"name": "julia-1.9"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.1"
"version": "1.10.0"
}
},
"nbformat": 4,