Merge branch 'main' of github.com:fverdugo/XM_40017 into main

This commit is contained in:
Francesc Verdugo
2023-08-14 09:58:30 +02:00
30 changed files with 630 additions and 175533 deletions

View File

@@ -33,6 +33,38 @@
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "1dc78750",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"jacobi_2_check (generic function with 1 method)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"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",
"gauss_seidel_1_check(answer) = answer_checker(answer,\"c\")\n",
"jacobi_1_check(answer) = answer_checker(answer, \"d\")\n",
"jacobi_2_check(answer) = answer_checker(answer, \"b\")"
]
},
{
"cell_type": "markdown",
"id": "d4cb59d5",
@@ -244,12 +276,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "4edad93f",
"metadata": {},
"outputs": [],
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"It's not correct. Keep trying! 💪\n"
]
}
],
"source": [
"#TODO answer (c)"
"answer = \"x\" # replace x with a, b, c or d\n",
"gauss_seidel_1_check(answer)"
]
},
{
@@ -304,7 +347,7 @@
"source": [
"### Ghost (aka halo) cells\n",
"\n",
"A usual way of handling this type of data dependencies is using so-called ghost cells. Ghost cells represent the missing data dependencies in the data owned by each process. After importing the appropriate values from the neighbor processes one can perform the usual sequential jacoby update locally in the processes."
"A usual way of handling this type of data dependencies is using so-called ghost cells. Ghost cells represent the missing data dependencies in the data owned by each process. After importing the appropriate values from the neighbor processes one can perform the usual sequential Jacobi update locally in the processes."
]
},
{
@@ -324,17 +367,31 @@
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Question:</b> Which is the communication and computation complexity in each process? N is the length of the vector and P the number of processes. \n",
"</div>"
"</div>\n",
"\n",
" a) Communication: O(P), computation: O(N/P)\n",
" b) Communication: O(1), computation: O(N)\n",
" c) Communication: O(P), computation: O(N)\n",
" d) Communication: O(1), computation: O(N/P)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "3a03fc4c",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"It's not correct. Keep trying! 💪\n"
]
}
],
"source": [
"#TODO give multiple options"
"answer = \"x\" # replace x with a, b, c or d\n",
"jacobi_1_check(answer)"
]
},
{
@@ -464,7 +521,9 @@
"metadata": {},
"outputs": [],
"source": [
"# TODO (b) 2 mesajes. Add another question if you find it useful"
"answer = \"x\" # replace x with a, b, c or d\n",
"jacobi_2_check(answer)\n",
"# TODO: think of more questions"
]
},
{
@@ -805,7 +864,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7bd7057a",
"id": "4fa7fad3",
"metadata": {},
"outputs": [],
"source": [
@@ -886,7 +945,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.0",
"display_name": "Julia 1.9.1",
"language": "julia",
"name": "julia-1.9"
},
@@ -894,7 +953,7 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.0"
"version": "1.9.1"
}
},
"nbformat": 4,