mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-12-30 02:38:31 +01:00
build based on 973c76f
This commit is contained in:
@@ -8,14 +8,9 @@
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Asynchronous programming in Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Asynchronous programming in Julia\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -583,14 +578,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a23b1c3",
|
||||
"id": "81de1c86",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Questions\n",
|
||||
"\n",
|
||||
"How long the next cells will take each?\n",
|
||||
"\n",
|
||||
"### Q1 (Asynchronous.ipynb)"
|
||||
"## Questions"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -600,7 +591,22 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"@time compute_π(100_000_000)"
|
||||
"t = @elapsed compute_π(100_000_000)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a23b1c3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q1):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -620,7 +626,15 @@
|
||||
"id": "5f19d38c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q2 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q2):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -640,7 +654,14 @@
|
||||
"id": "5041c355",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q3 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q3):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -660,7 +681,14 @@
|
||||
"id": "841b690e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q4 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q4):</b> How long will the compute time of the 2nd cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -693,7 +721,14 @@
|
||||
"id": "df663f11",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q5 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q5):</b> How long will the compute time of the 2nd cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -723,15 +758,15 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.8.5",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.8"
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.8.5"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -8,14 +8,9 @@
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Basics of Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Julia basics"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -437,9 +432,11 @@
|
||||
"id": "d36ba0ae",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Question 1\n",
|
||||
"\n",
|
||||
"Which will be the value of `x` in the last line ?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` in the last line ? (Think your answer before executing next cell to find out the result) \n",
|
||||
"</div>\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -486,7 +483,7 @@
|
||||
"id": "de95c63c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Once defined, a function can be called using bracket notation."
|
||||
"Once defined, a function can be called using bracket notation as you would expect."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -496,7 +493,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"result = add(1,3)"
|
||||
"add(1,3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -539,6 +536,41 @@
|
||||
"a .* b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "58a4e395",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` in the last line ?\n",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "4952cce7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function q(x)\n",
|
||||
" x = 2\n",
|
||||
" x\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a1134379",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"x = 1\n",
|
||||
"y = q(x)\n",
|
||||
"x"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d20bc3a4",
|
||||
@@ -947,9 +979,10 @@
|
||||
"id": "94599fa3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Question 2\n",
|
||||
"\n",
|
||||
"Which will be the value of `x` below?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` below? \n",
|
||||
"</div>\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1556,15 +1589,15 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.8.5",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.8"
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.8.5"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -7,28 +7,7 @@
|
||||
"source": [
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "aebf6482",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Printf\n",
|
||||
"\n",
|
||||
"function answer_checker(answer,solution)\n",
|
||||
" if answer == solution\n",
|
||||
" \"🥳 Well done! \"\n",
|
||||
" else\n",
|
||||
" \"It's not correct. Keep trying! 💪\"\n",
|
||||
" end |> println\n",
|
||||
"end\n",
|
||||
"q_1_check(answer) = answer_checker(answer,\"a\")\n",
|
||||
"q_2_check(answer) = answer_checker(answer,\"b\")"
|
||||
"### Programming large-scale parallel systems\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -36,11 +15,7 @@
|
||||
"id": "2133c064",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Distributed computing in Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Distributed computing in Julia\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -59,6 +34,35 @@
|
||||
"With this knowledge you will be able to implement simple and complex parallel algorithms in Julia."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b9a04db7",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-info\">\n",
|
||||
"<b>Note:</b> Do not forget to execute the next cell before starting this notebook! \n",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "aebf6482",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Printf\n",
|
||||
"function answer_checker(answer,solution)\n",
|
||||
" if answer == solution\n",
|
||||
" \"🥳 Well done! \"\n",
|
||||
" else\n",
|
||||
" \"It's not correct. Keep trying! 💪\"\n",
|
||||
" end |> println\n",
|
||||
"end\n",
|
||||
"q_1_check(answer) = answer_checker(answer,\"a\")\n",
|
||||
"q_2_check(answer) = answer_checker(answer,\"b\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "01af032c",
|
||||
@@ -763,9 +767,12 @@
|
||||
"id": "fd22b74b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q1 (Distributed.ipynb)\n",
|
||||
"\n",
|
||||
"How many integers are transferred between master and worker? Including both directions.\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q1):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"```julia\n",
|
||||
"a = rand(Int,4,4)\n",
|
||||
@@ -795,9 +802,11 @@
|
||||
"id": "dbe373d1",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q2 (Distributed.ipynb)\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q2):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"How many integers are transferred between master and worker? Including both directions.\n",
|
||||
"\n",
|
||||
"```julia\n",
|
||||
"a = rand(Int,4,4)\n",
|
||||
@@ -827,9 +836,10 @@
|
||||
"id": "c561a73d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q3 (Distributed.ipynb)\n",
|
||||
"\n",
|
||||
"Which value will be the value of `x` ?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q3):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -851,7 +861,9 @@
|
||||
"id": "835080aa",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q4 (Distributed.ipynb)\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q4):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"Which value will be the value of `x` ?"
|
||||
]
|
||||
@@ -1295,15 +1307,15 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.8.5",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.8"
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.8.5"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,37 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a976c0f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "038e5442",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Matrix-matrix multiplication"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f70e2f35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Contents\n",
|
||||
"\n",
|
||||
"In this notebook, we will:\n",
|
||||
"\n",
|
||||
"- Parallelize a simple algorithm\n",
|
||||
"- Study the performance of different parallelization strategies\n",
|
||||
"- Implement them using Julia"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "480af594",
|
||||
@@ -49,28 +81,6 @@
|
||||
"alg_3_complex_check(answer) = answer_checker(answer, \"d\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "038e5442",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Distributed matrix-matrix multiplication"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f70e2f35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Contents\n",
|
||||
"\n",
|
||||
"In this notebook, we will:\n",
|
||||
"\n",
|
||||
"- Parallelize a simple algorithm\n",
|
||||
"- Study the performance of different parallelization strategies\n",
|
||||
"- Implement them using Julia"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "96d2693d",
|
||||
@@ -82,7 +92,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "88bc2633",
|
||||
"metadata": {},
|
||||
@@ -118,7 +127,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "5828e243",
|
||||
"metadata": {},
|
||||
@@ -247,7 +255,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "6a706283",
|
||||
"metadata": {},
|
||||
@@ -278,7 +285,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "acfb354b",
|
||||
"metadata": {},
|
||||
@@ -329,7 +335,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "70087bce",
|
||||
"metadata": {},
|
||||
@@ -556,7 +561,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "62e5c637",
|
||||
"metadata": {},
|
||||
@@ -616,7 +620,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "fb6b572b",
|
||||
"metadata": {},
|
||||
@@ -775,7 +778,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "f1b8c712",
|
||||
"metadata": {},
|
||||
@@ -835,7 +837,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "c14ebcb3",
|
||||
"metadata": {},
|
||||
@@ -927,7 +928,7 @@
|
||||
"id": "a628a1df",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Implementation of algorithm 3\n",
|
||||
"### Exercise 1\n",
|
||||
"\n",
|
||||
"Implement algorithm 3 in the function below. For simplicity, assume that the number of rows of C is a multiple of the number of workers.\n"
|
||||
]
|
||||
@@ -1012,7 +1013,7 @@
|
||||
"id": "fa8d7f40",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### A more practical version of algorithm 1"
|
||||
"### Exercise 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1119,7 +1120,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.1",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@@ -1127,7 +1128,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.1"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user