|
9 | 9 | }, |
10 | 10 | "outputs": [], |
11 | 11 | "source": [ |
12 | | - "## Uncomment and Execute this cell if running on slurm based cluster\n", |
13 | | - "SRUN=\"srun\"" |
14 | | - ] |
15 | | - }, |
16 | | - { |
17 | | - "cell_type": "code", |
18 | | - "execution_count": null, |
19 | | - "id": "0sW2XPMR-687", |
20 | | - "metadata": { |
21 | | - "id": "0sW2XPMR-687" |
22 | | - }, |
23 | | - "outputs": [], |
24 | | - "source": [ |
25 | | - "## Uncomment and Execute this cell if running on google collab\n", |
26 | | - "#!pip install mpi4py\n", |
27 | | - "#SRUN=\"mpirun --allow-run-as-root --oversubscribe\"" |
| 12 | + "## Setup on \n", |
| 13 | + "MPIRUN=\"srun\"\n", |
| 14 | + "\n", |
| 15 | + "import os\n", |
| 16 | + "\n", |
| 17 | + "if os.getenv(\"COLAB_RELEASE_TAG\"): # If running in Google Colab\n", |
| 18 | + " !pip install mpi4py\n", |
| 19 | + " MPIRUN=\"mpirun --allow-run-as-root --oversubscribe\"\n" |
28 | 20 | ] |
29 | 21 | }, |
30 | 22 | { |
|
52 | 44 | }, |
53 | 45 | "outputs": [], |
54 | 46 | "source": [ |
55 | | - "!$SRUN -n 2 -c 2 python hello_world.py" |
| 47 | + "!$MPIRUN -n 2 -c 2 python hello_world.py" |
56 | 48 | ] |
57 | 49 | }, |
58 | 50 | { |
|
64 | 56 | }, |
65 | 57 | "outputs": [], |
66 | 58 | "source": [ |
67 | | - "!$SRUN -n 4 -c 4 python hello_world.py" |
| 59 | + "!$MPIRUN -n 4 -c 4 python hello_world.py" |
68 | 60 | ] |
69 | 61 | }, |
70 | 62 | { |
|
97 | 89 | }, |
98 | 90 | "outputs": [], |
99 | 91 | "source": [ |
100 | | - "!$SRUN -n 2 -c 2 python hello_world_with_ranks.py" |
| 92 | + "!$MPIRUN -n 2 -c 2 python hello_world_with_ranks.py" |
101 | 93 | ] |
102 | 94 | }, |
103 | 95 | { |
|
128 | 120 | "metadata": {}, |
129 | 121 | "outputs": [], |
130 | 122 | "source": [ |
131 | | - "!$SRUN -n 4 -c 4 python fizzbuzz.py" |
| 123 | + "!$MPIRUN -n 4 -c 4 python fizzbuzz.py" |
132 | 124 | ] |
133 | 125 | }, |
134 | 126 | { |
|
164 | 156 | }, |
165 | 157 | "outputs": [], |
166 | 158 | "source": [ |
167 | | - "!$SRUN -n 2 -c 2 python send_recv.py" |
| 159 | + "!$MPIRUN -n 2 -c 2 python send_recv.py" |
168 | 160 | ] |
169 | 161 | }, |
170 | 162 | { |
|
200 | 192 | }, |
201 | 193 | "outputs": [], |
202 | 194 | "source": [ |
203 | | - "!$SRUN -n 2 -c 2 python send_recv_eff.py" |
| 195 | + "!$MPIRUN -n 2 -c 2 python send_recv_eff.py" |
204 | 196 | ] |
205 | 197 | }, |
206 | 198 | { |
|
238 | 230 | }, |
239 | 231 | "outputs": [], |
240 | 232 | "source": [ |
241 | | - "!$SRUN -n 2 -c 2 python send_recv_numpy.py" |
| 233 | + "!$MPIRUN -n 2 -c 2 python send_recv_numpy.py" |
242 | 234 | ] |
243 | 235 | }, |
244 | 236 | { |
|
271 | 263 | }, |
272 | 264 | "outputs": [], |
273 | 265 | "source": [ |
274 | | - "!$SRUN -n 4 -c 4 python barrier.py" |
| 266 | + "!$MPIRUN -n 4 -c 4 python barrier.py" |
275 | 267 | ] |
276 | 268 | }, |
277 | 269 | { |
|
309 | 301 | }, |
310 | 302 | "outputs": [], |
311 | 303 | "source": [ |
312 | | - "!$SRUN -n 4 -c 4 python scatter.py" |
| 304 | + "!$MPIRUN -n 4 -c 4 python scatter.py" |
313 | 305 | ] |
314 | 306 | }, |
315 | 307 | { |
|
350 | 342 | }, |
351 | 343 | "outputs": [], |
352 | 344 | "source": [ |
353 | | - "!$SRUN -n 4 -c 4 python gather.py" |
| 345 | + "!$MPIRUN -n 4 -c 4 python gather.py" |
354 | 346 | ] |
355 | 347 | }, |
356 | 348 | { |
|
384 | 376 | }, |
385 | 377 | "outputs": [], |
386 | 378 | "source": [ |
387 | | - "!$SRUN -n 4 -c 4 python reduce.py" |
| 379 | + "!$MPIRUN -n 4 -c 4 python reduce.py" |
388 | 380 | ] |
389 | 381 | }, |
390 | 382 | { |
|
448 | 440 | }, |
449 | 441 | "outputs": [], |
450 | 442 | "source": [ |
451 | | - "!$SRUN -n 4 -c 4 python compute_pi.py" |
| 443 | + "!$MPIRUN -n 4 -c 4 python compute_pi.py" |
452 | 444 | ] |
453 | 445 | }, |
454 | 446 | { |
|
547 | 539 | }, |
548 | 540 | "outputs": [], |
549 | 541 | "source": [ |
550 | | - "!$SRUN -n 4 -c 4 python compute_mandelbot.py" |
| 542 | + "!$MPIRUN -n 4 -c 4 python compute_mandelbot.py" |
551 | 543 | ] |
552 | 544 | }, |
553 | 545 | { |
|
0 commit comments