Skip to content

Commit bbb00ae

Browse files
github-actions[bot]brycelelbach
authored andcommitted
stdpar/C++/2D Heat Equation: Update the build and mpirun commands, tune problem sizes for 4xL4, and remove extremely slow visualization.
1 parent a8055cf commit bbb00ae

File tree

1 file changed

+36
-162
lines changed
  • tutorials/stdpar/notebooks/cpp/lab2_heat

1 file changed

+36
-162
lines changed

tutorials/stdpar/notebooks/cpp/lab2_heat/heat.ipynb

Lines changed: 36 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@
5454
"metadata": {},
5555
"outputs": [],
5656
"source": [
57-
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} starting_point.cpp && mpirun -np 2 ./heat 256 256 16000\n",
58-
"!echo \"[clang++]:\" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} starting_point.cpp && mpirun -np 2 ./heat 256 256 16000\n",
59-
"!echo \"[nvc++]: \" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} starting_point.cpp && mpirun -np 2 ./heat 256 256 16000\n",
57+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 256 256 16000\"\n",
58+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} starting_point.cpp && {mpirun}\n",
59+
"!echo \"[clang++]:\" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} starting_point.cpp && {mpirun}\n",
60+
"!echo \"[nvc++]: \" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} starting_point.cpp && {mpirun}\n",
6061
"visualize()"
6162
]
6263
},
@@ -163,11 +164,11 @@
163164
"metadata": {},
164165
"outputs": [],
165166
"source": [
166-
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} exercise1.cpp -ltbb && mpirun -np 2 ./heat 256 256 16000\n",
167-
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} exercise1.cpp -ltbb && mpirun -np 2 ./heat 256 256 16000\n",
168-
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise1.cpp -stdpar=multicore && mpirun -np 2 ./heat 256 256 16000\n",
169-
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise1.cpp -stdpar=gpu && mpirun -np 2 ./heat 256 256 16000\n",
170-
"visualize()"
167+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
168+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} exercise1.cpp -ltbb && {mpirun}\n",
169+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} exercise1.cpp -ltbb && {mpirun}\n",
170+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise1.cpp -stdpar=multicore && {mpirun}\n",
171+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise1.cpp -stdpar=gpu && {mpirun}"
171172
]
172173
},
173174
{
@@ -188,11 +189,11 @@
188189
"metadata": {},
189190
"outputs": [],
190191
"source": [
191-
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} solutions/exercise1.cpp -ltbb && mpirun -np 2 ./heat 256 256 16000\n",
192-
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} solutions/exercise1.cpp -ltbb && mpirun -np 2 ./heat 256 256 16000\n",
193-
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=multicore && mpirun -np 2 ./heat 256 256 16000\n",
194-
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=gpu && mpirun -np 2 ./heat 256 256 16000\n",
195-
"visualize()"
192+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
193+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} solutions/exercise1.cpp -ltbb && {mpirun}\n",
194+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} solutions/exercise1.cpp -ltbb && {mpirun}\n",
195+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=multicore && {mpirun}\n",
196+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=gpu && {mpirun}"
196197
]
197198
},
198199
{
@@ -208,7 +209,8 @@
208209
"metadata": {},
209210
"outputs": [],
210211
"source": [
211-
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=gpu && mpirun -np 2 ./heat 1024 65536 2000"
212+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 2048 32768 2000\"\n",
213+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise1.cpp -stdpar=gpu && {mpirun}"
212214
]
213215
},
214216
{
@@ -329,34 +331,11 @@
329331
"metadata": {},
330332
"outputs": [],
331333
"source": [
332-
"!rm -f output heat\n",
333-
"!OMPI_CXX=g++ mpicxx -std=c++20 -Ofast -march=native -o heat exercise2.cpp -ltbb\n",
334-
"!mpirun -np 2 ./heat 256 256 16000\n",
335-
"visualize()"
336-
]
337-
},
338-
{
339-
"cell_type": "code",
340-
"execution_count": null,
341-
"metadata": {},
342-
"outputs": [],
343-
"source": [
344-
"!rm -f output heat\n",
345-
"!OMPI_CXX=clang++ mpicxx -std=c++20 -Ofast -march=native -o heat exercise2.cpp -ltbb\n",
346-
"!mpirun -np 2 ./heat 256 256 16000\n",
347-
"visualize()"
348-
]
349-
},
350-
{
351-
"cell_type": "code",
352-
"execution_count": null,
353-
"metadata": {},
354-
"outputs": [],
355-
"source": [
356-
"!rm -f output heat\n",
357-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -stdpar=gpu -o heat exercise2.cpp -ltbb\n",
358-
"!mpirun -np 2 ./heat 256 256 16000\n",
359-
"visualize()"
334+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
335+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} exercise2.cpp -ltbb && {mpirun}\n",
336+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} exercise2.cpp -ltbb && {mpirun}\n",
337+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise2.cpp -stdpar=multicore && {mpirun}\n",
338+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise2.cpp -stdpar=gpu && {mpirun}"
360339
]
361340
},
362341
{
@@ -376,46 +355,11 @@
376355
"metadata": {},
377356
"outputs": [],
378357
"source": [
379-
"!rm -f output heat\n",
380-
"!OMPI_CXX=g++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -o heat solutions/exercise2.cpp -ltbb\n",
381-
"!mpirun -np 2 ./heat 256 256 16000\n",
382-
"visualize()"
383-
]
384-
},
385-
{
386-
"cell_type": "code",
387-
"execution_count": null,
388-
"metadata": {},
389-
"outputs": [],
390-
"source": [
391-
"!rm -f output heat\n",
392-
"!OMPI_CXX=clang++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -o heat solutions/exercise2.cpp -ltbb\n",
393-
"!mpirun -np 2 ./heat 256 256 16000\n",
394-
"visualize()"
395-
]
396-
},
397-
{
398-
"cell_type": "code",
399-
"execution_count": null,
400-
"metadata": {},
401-
"outputs": [],
402-
"source": [
403-
"!rm -f output heat\n",
404-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o heat solutions/exercise2.cpp\n",
405-
"!mpirun -np 2 ./heat 256 256 16000\n",
406-
"visualize()"
407-
]
408-
},
409-
{
410-
"cell_type": "code",
411-
"execution_count": null,
412-
"metadata": {},
413-
"outputs": [],
414-
"source": [
415-
"!rm -f output heat\n",
416-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o heat solutions/exercise2.cpp\n",
417-
"!UCX_RNDV_FRAG_MEM_TYPE=cuda mpirun -np 2 ./heat 256 256 16000\n",
418-
"visualize()"
358+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
359+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} solutions/exercise2.cpp -ltbb && {mpirun}\n",
360+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} solutions/exercise2.cpp -ltbb && {mpirun}\n",
361+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise2.cpp -stdpar=multicore && {mpirun}\n",
362+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise2.cpp -stdpar=gpu && {mpirun}"
419363
]
420364
},
421365
{
@@ -492,46 +436,11 @@
492436
"metadata": {},
493437
"outputs": [],
494438
"source": [
495-
"!rm -f output heat\n",
496-
"!OMPI_CXX=g++ mpicxx -std=c++20 -Ofast -march=native -o heat exercise3.cpp -ltbb\n",
497-
"!mpirun -np 2 ./heat 256 256 16000\n",
498-
"visualize()"
499-
]
500-
},
501-
{
502-
"cell_type": "code",
503-
"execution_count": null,
504-
"metadata": {},
505-
"outputs": [],
506-
"source": [
507-
"!rm -f output heat\n",
508-
"!OMPI_CXX=clang++ mpicxx -std=c++20 -Ofast -march=native -o heat exercise3.cpp -ltbb\n",
509-
"!mpirun -np 2 ./heat 256 256 16000\n",
510-
"visualize()"
511-
]
512-
},
513-
{
514-
"cell_type": "code",
515-
"execution_count": null,
516-
"metadata": {},
517-
"outputs": [],
518-
"source": [
519-
"!rm -f output heat\n",
520-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -stdpar=multicore -o heat exercise3.cpp\n",
521-
"!mpirun -np 2 ./heat 256 256 16000\n",
522-
"visualize()"
523-
]
524-
},
525-
{
526-
"cell_type": "code",
527-
"execution_count": null,
528-
"metadata": {},
529-
"outputs": [],
530-
"source": [
531-
"!rm -f output heat\n",
532-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -stdpar=gpu -o heat exercise3.cpp\n",
533-
"!UCX_RNDV_FRAG_MEM_TYPE=cuda mpirun -np 2 ./heat 256 256 16000\n",
534-
"visualize()"
439+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
440+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} exercise3.cpp -ltbb && {mpirun}\n",
441+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} exercise3.cpp -ltbb && {mpirun}\n",
442+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise3.cpp -stdpar=multicore && {mpirun}\n",
443+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} exercise3.cpp -stdpar=gpu && {mpirun}"
535444
]
536445
},
537446
{
@@ -556,46 +465,11 @@
556465
"metadata": {},
557466
"outputs": [],
558467
"source": [
559-
"!rm -f output heat\n",
560-
"!OMPI_CXX=g++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -o heat solutions/exercise3.cpp -ltbb\n",
561-
"!mpirun -np 2 ./heat 256 256 16000\n",
562-
"visualize()"
563-
]
564-
},
565-
{
566-
"cell_type": "code",
567-
"execution_count": null,
568-
"metadata": {},
569-
"outputs": [],
570-
"source": [
571-
"!rm -f output heat\n",
572-
"!OMPI_CXX=clang++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -o heat solutions/exercise3.cpp -ltbb\n",
573-
"!mpirun -np 2 ./heat 256 256 16000\n",
574-
"visualize()"
575-
]
576-
},
577-
{
578-
"cell_type": "code",
579-
"execution_count": null,
580-
"metadata": {},
581-
"outputs": [],
582-
"source": [
583-
"!rm -f output heat\n",
584-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o heat solutions/exercise3.cpp\n",
585-
"!mpirun -np 2 ./heat 256 256 16000\n",
586-
"visualize()"
587-
]
588-
},
589-
{
590-
"cell_type": "code",
591-
"execution_count": null,
592-
"metadata": {},
593-
"outputs": [],
594-
"source": [
595-
"!rm -f output heat\n",
596-
"!OMPI_CXX=nvc++ mpicxx -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o heat solutions/exercise3.cpp\n",
597-
"!UCX_RNDV_FRAG_MEM_TYPE=cuda mpirun -np 2 ./heat 256 256 16000\n",
598-
"visualize()"
468+
"mpirun=\"mpirun -np 4 ./bind_one_gpu_per_rank.bash ./heat 1024 16384 500\"\n",
469+
"!echo \"[g++]: \" && rm -f output heat && OMPI_CXX=g++ {mpicxx} solutions/exercise3.cpp -ltbb && {mpirun}\n",
470+
"!echo \"[clang++]: \" && rm -f output heat && OMPI_CXX=clang++ {mpicxx} solutions/exercise3.cpp -ltbb && {mpirun}\n",
471+
"!echo \"[nvc++ CPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise3.cpp -stdpar=multicore && {mpirun}\n",
472+
"!echo \"[nvc++ GPU]:\" && rm -f output heat && OMPI_CXX=nvc++ {mpicxx} solutions/exercise3.cpp -stdpar=gpu && {mpirun}"
599473
]
600474
}
601475
],

0 commit comments

Comments
 (0)