Add questions to TSP and PDEs notebooks

This commit is contained in:
Gelieza K
2023-11-16 12:50:09 +01:00
parent 685d3db6a5
commit b628e017c1
4 changed files with 4466 additions and 67 deletions

View File

@@ -422,7 +422,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "a66cbf9a",
"metadata": {},
"outputs": [],
@@ -433,10 +433,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "e0d63c6b",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"3-element Vector{Int64}:\n",
" 2\n",
" 3\n",
" 4"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"if procs() == workers()\n",
" nw = 3\n",
@@ -455,7 +469,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "d39c7bb2",
"metadata": {
"code_folding": []
@@ -516,7 +530,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "f1a8db8f",
"metadata": {},
"outputs": [],
@@ -546,12 +560,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "68851107",
"metadata": {
"code_folding": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" From worker 2:\t(rank, u) = (0, [-1.0, -0.75390625, -0.548828125, -0.3427734375, -0.224609375, -0.06640625])\n",
" From worker 3:\t(rank, u) = (1, [-0.1796875, -0.09765625, -0.0439453125, 0.0439453125, 0.09765625, 0.1796875])\n",
" From worker 4:\t(rank, u) = (2, [0.06640625, 0.224609375, 0.3427734375, 0.548828125, 0.75390625, 1.0])\n",
" From worker 2:\tresults ≈ jacobi(n, niters) = true\n"
]
}
],
"source": [
"@everywhere workers() begin\n",
" # Call jacobi in parallel\n",
@@ -614,10 +639,10 @@
"<b>Question:</b> At the end of function jacobi_mpi ...\n",
"</div>\n",
"\n",
" a) each rank holds the complete solution.\n",
" b) only the root process holds the solution. \n",
" c) the values of the ghost cells of u are not consistent with the neighbors\n",
" d) the ghost cells of u contain the initial values -1 and 1 in all ranks"
" a) each process holds the complete solution.\n",
" b) the complete solution is gathered in the root process. \n",
" c) each process contains the solution for the local partition. \n",
" d) the ghost cells of u contain the initial values -1 and 1 in all processes."
]
},
{