mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-08 23:54:25 +01:00
Minor enhancements in julia_distributed notebook.
This commit is contained in:
parent
0a9199793a
commit
a727478b45
@ -37,7 +37,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"### Creating a task\n",
|
"### Creating a task\n",
|
||||||
"\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": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Julia 1.9.0",
|
"display_name": "Julia 1.10.0",
|
||||||
"language": "julia",
|
"language": "julia",
|
||||||
"name": "julia-1.9"
|
"name": "julia-1.10"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"file_extension": ".jl",
|
"file_extension": ".jl",
|
||||||
"mimetype": "application/julia",
|
"mimetype": "application/julia",
|
||||||
"name": "julia",
|
"name": "julia",
|
||||||
"version": "1.9.0"
|
"version": "1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@ -1259,7 +1259,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "36969278",
|
"id": "92248ad5",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"<div class=\"alert alert-block alert-info\">\n",
|
"<div class=\"alert alert-block alert-info\">\n",
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## Contents\n",
|
"## Contents\n",
|
||||||
"\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",
|
"\n",
|
||||||
"- How to create Julia processes\n",
|
"- How to create Julia processes\n",
|
||||||
"- How to execute code remotely\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."
|
"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",
|
"cell_type": "markdown",
|
||||||
"id": "ec225103",
|
"id": "ec225103",
|
||||||
@ -621,8 +631,6 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"### This will not work!\n",
|
"### This will not work!\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",
|
|
||||||
"```julia\n",
|
"```julia\n",
|
||||||
"chnl = Channel{Int}()\n",
|
"chnl = Channel{Int}()\n",
|
||||||
"@spawnat 4 begin\n",
|
"@spawnat 4 begin\n",
|
||||||
@ -632,7 +640,10 @@
|
|||||||
" close(chnl)\n",
|
" close(chnl)\n",
|
||||||
"end\n",
|
"end\n",
|
||||||
"take!(chnl)\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": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Julia 1.9.1",
|
"display_name": "Julia 1.10.0",
|
||||||
"language": "julia",
|
"language": "julia",
|
||||||
"name": "julia-1.9"
|
"name": "julia-1.10"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"file_extension": ".jl",
|
"file_extension": ".jl",
|
||||||
"mimetype": "application/julia",
|
"mimetype": "application/julia",
|
||||||
"name": "julia",
|
"name": "julia",
|
||||||
"version": "1.9.1"
|
"version": "1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user