mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-09 00:34:24 +01:00
Saving
This commit is contained in:
parent
d2af3894cf
commit
f283a8f8da
@ -35,21 +35,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"id": "1dc78750",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"jacobi_2_check (generic function with 1 method)"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Printf\n",
|
||||
"\n",
|
||||
@ -109,21 +98,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"id": "14a58308",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"jacobi (generic function with 1 method)"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function jacobi(n,niters)\n",
|
||||
" u = zeros(n+2)\n",
|
||||
@ -142,28 +120,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"id": "76e1eba1",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"7-element Vector{Float64}:\n",
|
||||
" -1.0\n",
|
||||
" 0.0\n",
|
||||
" 0.0\n",
|
||||
" 0.0\n",
|
||||
" 0.0\n",
|
||||
" 0.0\n",
|
||||
" 1.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"jacobi(5,0)"
|
||||
]
|
||||
@ -276,20 +236,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "4edad93f",
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"It's not correct. Keep trying! 💪\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"answer = \"x\" # replace x with a, b, c or d\n",
|
||||
"gauss_seidel_1_check(answer)"
|
||||
@ -326,7 +278,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "60d64ef2",
|
||||
"id": "a9667c42",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -336,7 +288,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a4b9af33",
|
||||
"id": "3f90d701",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Data dependencies\n",
|
||||
@ -353,7 +305,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "b9656556",
|
||||
"id": "210e80e7",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -376,7 +328,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ab1d263d",
|
||||
"id": "3c437326",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -400,7 +352,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "33aeb726",
|
||||
"id": "98e0eb71",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -410,7 +362,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "06e45af2",
|
||||
"id": "0148f9b3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Thus, the algorithm is usually implemented following two main phases at each iteration Jacobi:\n",
|
||||
@ -426,7 +378,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "d4da41d9",
|
||||
"id": "baccd833",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -436,7 +388,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "486c46bf",
|
||||
"id": "8b436c73",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Efficiency"
|
||||
@ -459,18 +411,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": null,
|
||||
"id": "3a03fc4c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"It's not correct. Keep trying! 💪\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"answer = \"x\" # replace x with a, b, c or d\n",
|
||||
"jacobi_1_check(answer)"
|
||||
@ -627,7 +571,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "d3c3a458",
|
||||
"id": "7d66b1a2",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -653,7 +597,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "43040f66",
|
||||
"id": "f14142ea",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -686,21 +630,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": null,
|
||||
"id": "4ab59b2f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"jacobi_2d (generic function with 1 method)"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function jacobi_2d(n,niters)\n",
|
||||
" u = zeros(n+2,n+2)\n",
|
||||
@ -724,33 +657,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": null,
|
||||
"id": "6da0aa54",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"12×12 Matrix{Float64}:\n",
|
||||
" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0\n",
|
||||
" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"u = jacobi_2d(10,0)"
|
||||
]
|
||||
@ -804,7 +714,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "dc342d8a",
|
||||
"id": "e52959a5",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -814,7 +724,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "766bc1d4",
|
||||
"id": "e0cee28b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Which of the thee alternatives is more efficient? To answer this question we need to quantify how much data is processed and communicated in each case. The following analysis assumes that the grid is of $N$ by $N$ cells and that the number of processes is $P$."
|
||||
@ -822,7 +732,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2580b969",
|
||||
"id": "f6ea16f5",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 1D block partition\n"
|
||||
@ -835,7 +745,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "e51f4de6",
|
||||
"id": "0cfeca62",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -845,7 +755,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6a061b83",
|
||||
"id": "4600c94a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"- We update $N^2/P$ items per iteration\n",
|
||||
@ -869,7 +779,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "d16e5534",
|
||||
"id": "e5142fa1",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -879,7 +789,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3459d6bd",
|
||||
"id": "091b0310",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"- We update $N^2/P$ items per iteration\n",
|
||||
@ -890,10 +800,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "cac2194d",
|
||||
"id": "a8fb49a3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 2D Cyclic partition"
|
||||
"### 2D cyclic partition"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -903,7 +813,7 @@
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "9c2d4518",
|
||||
"id": "1bc30b74",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
@ -913,7 +823,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "88c6c735",
|
||||
"id": "c45f4e44",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"- We update $N^2/P$ items\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user