diff --git a/notebooks/matrix_matrix.ipynb b/notebooks/matrix_matrix.ipynb
index 5f1fd22..9aad890 100644
--- a/notebooks/matrix_matrix.ipynb
+++ b/notebooks/matrix_matrix.ipynb
@@ -255,6 +255,19 @@
"Question: Which is the complexity (number of operations) of the serial algorithm? Assume that all matrices are $N$-by-$N$ matrices. \n",
"\n",
"\n",
+ "```julia\n",
+ "for j in 1:N\n",
+ " for i in 1:N\n",
+ " Cij = z\n",
+ " for k in 1:N\n",
+ " @inbounds Cij += A[i,k]*B[k,j]\n",
+ " end\n",
+ " C[i,j] = Cij\n",
+ " end\n",
+ "end\n",
+ "```\n",
+ "\n",
+ "\n",
" a) O(1)\n",
" b) O(N)\n",
" c) O(N²)\n",
@@ -538,7 +551,7 @@
},
{
"cell_type": "markdown",
- "id": "dac6a50b",
+ "id": "501d4008",
"metadata": {},
"source": [
"### Communication overhead\n",
@@ -553,8 +566,25 @@
"\n",
"
\n",
"Question: How many scalars are communicated from and to a worker? Assume that matrices A, B, and C are N by N matrices.\n",
+ "
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "45f44171",
+ "metadata": {},
+ "source": [
+ " \n",
+ "

\n",
"
\n",
- "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "dac6a50b",
+ "metadata": {},
+ "source": [
" a) O(1)\n",
" b) O(N)\n",
" c) O(N²)\n",
@@ -796,7 +826,7 @@
},
{
"cell_type": "markdown",
- "id": "e2c6f60a",
+ "id": "2b1e3b24",
"metadata": {},
"source": [
"### Complexity\n",
@@ -809,8 +839,25 @@
"\n",
"\n",
"Question: Which is the complexity of the communication and computations done by a worker in algorithm 2?\n",
- "
\n",
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "77808863",
+ "metadata": {},
+ "source": [
"\n",
+ "\n",
+ "

\n",
+ "
\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e2c6f60a",
+ "metadata": {},
+ "source": [
" a) O(N) communication and O(N^2) computation\n",
" b) O(N^2) communication and O(N^2) computation\n",
" c) O(N^3) communication and O(N^3) computation\n",
@@ -1020,8 +1067,6 @@
" @assert size(B,1) == l\n",
" @assert mod(m,nworkers()) == 0\n",
" # Implement here\n",
- " \n",
- " C\n",
"end"
]
},
@@ -1066,7 +1111,7 @@
"outputs": [],
"source": [
"P = nworkers()\n",
- "load = 100\n",
+ "load = 50 # try with 50, 100, and 200\n",
"N = load*P\n",
"A = rand(N,N)\n",
"B = rand(N,N)\n",