Skip to content

Commit 5ab24b6

Browse files
committed
Update heat example
1 parent 10ea6e4 commit 5ab24b6

File tree

6 files changed

+238
-516
lines changed

6 files changed

+238
-516
lines changed

labs/cpp/lab1_daxpy/daxpy.ipynb

Lines changed: 62 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,9 @@
203203
"metadata": {},
204204
"outputs": [],
205205
"source": [
206-
"!echo -n \"[g++] \" && rm daxpy || true\n",
207-
"!g++ {flags} exercise1.cpp && ./daxpy {N}\n",
208-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
209-
"!clang++ {flags} exercise1.cpp && ./daxpy {N}\n",
210-
"!echo -n \"[nvc++] \" && rm daxpy || true\n",
211-
"!nvc++ {flags} exercise1.cpp && ./daxpy {N}"
206+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise1.cpp && ./daxpy {N}\n",
207+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise1.cpp && ./daxpy {N}\n",
208+
"!echo -n \"[nvc++] \" && rm daxpy || true && nvc++ {flags} exercise1.cpp && ./daxpy {N}"
212209
]
213210
},
214211
{
@@ -231,12 +228,9 @@
231228
"metadata": {},
232229
"outputs": [],
233230
"source": [
234-
"!echo -n \"[g++] \" && rm daxpy || true\n",
235-
"!g++ {flags} solutions/exercise1.cpp && ./daxpy {N}\n",
236-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
237-
"!clang++ {flags} solutions/exercise1.cpp && ./daxpy {N}\n",
238-
"!echo -n \"[nvc++] \" && rm daxpy || true\n",
239-
"!nvc++ {flags} solutions/exercise1.cpp && ./daxpy {N}"
231+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise1.cpp && ./daxpy {N}\n",
232+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise1.cpp && ./daxpy {N}\n",
233+
"!echo -n \"[nvc++] \" && rm daxpy || true && nvc++ {flags} solutions/exercise1.cpp && ./daxpy {N}"
240234
]
241235
},
242236
{
@@ -285,18 +279,10 @@
285279
"metadata": {},
286280
"outputs": [],
287281
"source": [
288-
"!rm daxpy || true\n",
289-
"!g++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy exercise2.cpp -ltbb\n",
290-
"!./daxpy 1000000\n",
291-
"!rm daxpy || true\n",
292-
"!clang++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy exercise2.cpp -ltbb\n",
293-
"!./daxpy 1000000\n",
294-
"!rm daxpy || true\n",
295-
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o daxpy exercise2.cpp\n",
296-
"!./daxpy 1000000\n",
297-
"!rm daxpy || true\n",
298-
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o daxpy exercise2.cpp\n",
299-
"!./daxpy 100000000"
282+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise2.cpp -ltbb && ./daxpy {N}\n",
283+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise2.cpp -ltbb && ./daxpy {N}\n",
284+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise2.cpp -stdpar=multicore && ./daxpy {N}\n",
285+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise2.cpp -stdpar=gpu && ./daxpy {N}"
300286
]
301287
},
302288
{
@@ -316,18 +302,10 @@
316302
"metadata": {},
317303
"outputs": [],
318304
"source": [
319-
"!rm daxpy || true\n",
320-
"!g++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise2.cpp -ltbb\n",
321-
"!./daxpy 1000000\n",
322-
"!rm daxpy || true\n",
323-
"!clang++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise2.cpp -ltbb\n",
324-
"!./daxpy 1000000\n",
325-
"!rm daxpy || true\n",
326-
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o daxpy solutions/exercise2.cpp\n",
327-
"!./daxpy 1000000\n",
328-
"!rm daxpy || true\n",
329-
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o daxpy solutions/exercise2.cpp\n",
330-
"!./daxpy 100000000"
305+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise2.cpp -ltbb && ./daxpy {N}\n",
306+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise2.cpp -ltbb && ./daxpy {N}\n",
307+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise2.cpp -stdpar=multicore && ./daxpy {N}\n",
308+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise2.cpp -stdpar=gpu && ./daxpy {N}"
331309
]
332310
},
333311
{
@@ -370,14 +348,10 @@
370348
"metadata": {},
371349
"outputs": [],
372350
"source": [
373-
"!echo -n \"[g++] \" && rm daxpy || true\n",
374-
"!g++ {flags} exercise3.cpp -ltbb && ./daxpy {N}\n",
375-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
376-
"!clang++ {flags} exercise3.cpp -ltbb && ./daxpy {N}\n",
377-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
378-
"!nvc++ {flags} -stdpar=multicore exercise3.cpp && ./daxpy {N}\n",
379-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
380-
"!nvc++ {flags} -stdpar=gpu exercise3.cpp && ./daxpy {N}"
351+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise3.cpp -ltbb && ./daxpy {N}\n",
352+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise3.cpp -ltbb && ./daxpy {N}\n",
353+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise3.cpp -stdpar=multicore && ./daxpy {N}\n",
354+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise3.cpp -stdpar=gpu && ./daxpy {N}"
381355
]
382356
},
383357
{
@@ -397,14 +371,10 @@
397371
"metadata": {},
398372
"outputs": [],
399373
"source": [
400-
"!echo -n \"[g++] \" && rm daxpy || true\n",
401-
"!g++ {flags} solutions/exercise3.cpp -ltbb && ./daxpy {N}\n",
402-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
403-
"!clang++ {flags} solutions/exercise3.cpp -ltbb && ./daxpy {N}\n",
404-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
405-
"!nvc++ {flags} -stdpar=multicore solutions/exercise3.cpp && ./daxpy {N}\n",
406-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
407-
"!nvc++ {flags} -stdpar=gpu solutions/exercise3.cpp && ./daxpy {N}"
374+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise3.cpp -ltbb && ./daxpy {N}\n",
375+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise3.cpp -ltbb && ./daxpy {N}\n",
376+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise3.cpp -stdpar=multicore && ./daxpy {N}\n",
377+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise3.cpp -stdpar=gpu && ./daxpy {N}"
408378
]
409379
},
410380
{
@@ -504,14 +474,10 @@
504474
"metadata": {},
505475
"outputs": [],
506476
"source": [
507-
"!echo -n \"[g++] \" && rm daxpy || true\n",
508-
"!g++ {flags} exercise4.cpp -ltbb && ./daxpy {N}\n",
509-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
510-
"!clang++ {flags} exercise4.cpp -ltbb && ./daxpy {N}\n",
511-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
512-
"!nvc++ {flags} -stdpar=multicore exercise4.cpp && ./daxpy {N}\n",
513-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
514-
"!nvc++ {flags} -stdpar=gpu exercise4.cpp && ./daxpy {N}"
477+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise4.cpp -ltbb && ./daxpy {N}\n",
478+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise4.cpp -ltbb && ./daxpy {N}\n",
479+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise4.cpp -stdpar=multicore && ./daxpy {N}\n",
480+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise4.cpp -stdpar=gpu && ./daxpy {N}"
515481
]
516482
},
517483
{
@@ -531,14 +497,10 @@
531497
"metadata": {},
532498
"outputs": [],
533499
"source": [
534-
"!echo -n \"[g++] \" && rm daxpy || true\n",
535-
"!g++ {flags} solutions/exercise4.cpp -ltbb && ./daxpy {N}\n",
536-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
537-
"!clang++ {flags} solutions/exercise4.cpp -ltbb && ./daxpy {N}\n",
538-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
539-
"!nvc++ {flags} -stdpar=multicore solutions/exercise4.cpp && ./daxpy {N}\n",
540-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
541-
"!nvc++ {flags} -stdpar=gpu solutions/exercise4.cpp && ./daxpy {N}"
500+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise4.cpp -ltbb && ./daxpy {N}\n",
501+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise4.cpp -ltbb && ./daxpy {N}\n",
502+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise4.cpp -stdpar=multicore && ./daxpy {N}\n",
503+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise4.cpp -stdpar=gpu && ./daxpy {N}"
542504
]
543505
},
544506
{
@@ -587,14 +549,10 @@
587549
"metadata": {},
588550
"outputs": [],
589551
"source": [
590-
"!echo -n \"[g++] \" && rm daxpy || true\n",
591-
"!g++ {flags} exercise5.cpp -ltbb && ./daxpy {N}\n",
592-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
593-
"!clang++ {flags} exercise5.cpp -ltbb && ./daxpy {N}\n",
594-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
595-
"!nvc++ {flags} -stdpar=multicore exercise5.cpp && ./daxpy {N}\n",
596-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
597-
"!nvc++ {flags} -stdpar=gpu exercise5.cpp && ./daxpy {N}"
552+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise5.cpp -ltbb && ./daxpy {N}\n",
553+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise5.cpp -ltbb && ./daxpy {N}\n",
554+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise5.cpp -stdpar=multicore && ./daxpy {N}\n",
555+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise5.cpp -stdpar=gpu && ./daxpy {N}"
598556
]
599557
},
600558
{
@@ -614,14 +572,10 @@
614572
"metadata": {},
615573
"outputs": [],
616574
"source": [
617-
"!echo -n \"[g++] \" && rm daxpy || true\n",
618-
"!g++ {flags} solutions/exercise5.cpp -ltbb && ./daxpy {N}\n",
619-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
620-
"!clang++ {flags} solutions/exercise5.cpp -ltbb && ./daxpy {N}\n",
621-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
622-
"!nvc++ {flags} -stdpar=multicore solutions/exercise5.cpp && ./daxpy {N}\n",
623-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
624-
"!nvc++ {flags} -stdpar=gpu solutions/exercise5.cpp && ./daxpy {N}"
575+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise5.cpp -ltbb && ./daxpy {N}\n",
576+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise5.cpp -ltbb && ./daxpy {N}\n",
577+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise5.cpp -stdpar=multicore && ./daxpy {N}\n",
578+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise5.cpp -stdpar=gpu && ./daxpy {N}"
625579
]
626580
},
627581
{
@@ -721,14 +675,10 @@
721675
"metadata": {},
722676
"outputs": [],
723677
"source": [
724-
"!echo -n \"[g++] \" && rm daxpy || true\n",
725-
"!g++ {flags} exercise6.cpp -ltbb && ./daxpy {N}\n",
726-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
727-
"!clang++ {flags} exercise6.cpp -ltbb && ./daxpy {N}\n",
728-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
729-
"!nvc++ {flags} -stdpar=multicore exercise6.cpp && ./daxpy {N}\n",
730-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
731-
"!nvc++ {flags} -stdpar=gpu exercise6.cpp && ./daxpy {N}"
678+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise6.cpp -ltbb && ./daxpy {N}\n",
679+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise6.cpp -ltbb && ./daxpy {N}\n",
680+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise6.cpp -stdpar=multicore && ./daxpy {N}\n",
681+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise6.cpp -stdpar=gpu && ./daxpy {N}"
732682
]
733683
},
734684
{
@@ -748,14 +698,10 @@
748698
"metadata": {},
749699
"outputs": [],
750700
"source": [
751-
"!echo -n \"[g++] \" && rm daxpy || true\n",
752-
"!g++ {flags} solutions/exercise6.cpp -ltbb && ./daxpy {N}\n",
753-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
754-
"!clang++ {flags} solutions/exercise6.cpp -ltbb && ./daxpy {N}\n",
755-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
756-
"!nvc++ {flags} -stdpar=multicore solutions/exercise6.cpp && ./daxpy {N}\n",
757-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
758-
"!nvc++ {flags} -stdpar=gpu solutions/exercise6.cpp && ./daxpy {N}"
701+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise6.cpp -ltbb && ./daxpy {N}\n",
702+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise6.cpp -ltbb && ./daxpy {N}\n",
703+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise6.cpp -stdpar=multicore && ./daxpy {N}\n",
704+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise6.cpp -stdpar=gpu && ./daxpy {N}"
759705
]
760706
},
761707
{
@@ -835,14 +781,10 @@
835781
"metadata": {},
836782
"outputs": [],
837783
"source": [
838-
"!echo -n \"[g++] \" && rm daxpy || true\n",
839-
"!g++ {flags} exercise7.cpp -ltbb && ./daxpy {N}\n",
840-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
841-
"!clang++ {flags} exercise7.cpp -ltbb && ./daxpy {N}\n",
842-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
843-
"!nvc++ {flags} -stdpar=multicore exercise7.cpp && ./daxpy {N}\n",
844-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
845-
"!nvc++ {flags} -stdpar=gpu exercise7.cpp && ./daxpy {N}"
784+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise7.cpp -ltbb && ./daxpy {N}\n",
785+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise7.cpp -ltbb && ./daxpy {N}\n",
786+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise7.cpp -stdpar=multicore && ./daxpy {N}\n",
787+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise7.cpp -stdpar=gpu && ./daxpy {N}"
846788
]
847789
},
848790
{
@@ -862,14 +804,10 @@
862804
"metadata": {},
863805
"outputs": [],
864806
"source": [
865-
"!echo -n \"[g++] \" && rm daxpy || true\n",
866-
"!g++ {flags} solutions/exercise7.cpp -ltbb && ./daxpy {N}\n",
867-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
868-
"!clang++ {flags} solutions/exercise7.cpp -ltbb && ./daxpy {N}\n",
869-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
870-
"!nvc++ {flags} -stdpar=multicore solutions/exercise7.cpp && ./daxpy {N}\n",
871-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
872-
"!nvc++ {flags} -stdpar=gpu solutions/exercise7.cpp && ./daxpy {N}"
807+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise7.cpp -ltbb && ./daxpy {N}\n",
808+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise7.cpp -ltbb && ./daxpy {N}\n",
809+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise7.cpp -stdpar=multicore && ./daxpy {N}\n",
810+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise7.cpp -stdpar=gpu && ./daxpy {N}"
873811
]
874812
},
875813
{
@@ -933,14 +871,10 @@
933871
"metadata": {},
934872
"outputs": [],
935873
"source": [
936-
"!echo -n \"[g++] \" && rm daxpy || true\n",
937-
"!g++ {flags} exercise8.cpp -ltbb && ./daxpy {N}\n",
938-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
939-
"!clang++ {flags} exercise8.cpp -ltbb && ./daxpy {N}\n",
940-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
941-
"!nvc++ {flags} -stdpar=multicore exercise8.cpp && ./daxpy {N}\n",
942-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
943-
"!nvc++ {flags} -stdpar=gpu exercise8.cpp && ./daxpy {N}"
874+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} exercise8.cpp -ltbb && ./daxpy {N}\n",
875+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} exercise8.cpp -ltbb && ./daxpy {N}\n",
876+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} exercise8.cpp -stdpar=multicore && ./daxpy {N}\n",
877+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} exercise8.cpp -stdpar=gpu && ./daxpy {N}"
944878
]
945879
},
946880
{
@@ -960,14 +894,10 @@
960894
"metadata": {},
961895
"outputs": [],
962896
"source": [
963-
"!echo -n \"[g++] \" && rm daxpy || true\n",
964-
"!g++ {flags} solutions/exercise8.cpp -ltbb && ./daxpy {N}\n",
965-
"!echo -n \"[clang++] \" && rm daxpy || true\n",
966-
"!clang++ {flags} solutions/exercise8.cpp -ltbb && ./daxpy {N}\n",
967-
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true\n",
968-
"!nvc++ {flags} -stdpar=multicore solutions/exercise8.cpp && ./daxpy {N}\n",
969-
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true\n",
970-
"!nvc++ {flags} -stdpar=gpu solutions/exercise8.cpp && ./daxpy {N}"
897+
"!echo -n \"[g++] \" && rm daxpy || true && g++ {flags} solutions/exercise8.cpp -ltbb && ./daxpy {N}\n",
898+
"!echo -n \"[clang++] \" && rm daxpy || true && clang++ {flags} solutions/exercise8.cpp -ltbb && ./daxpy {N}\n",
899+
"!echo -n \"[nvc++ CPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise8.cpp -stdpar=multicore && ./daxpy {N}\n",
900+
"!echo -n \"[nvc++ GPU] \" && rm daxpy || true && nvc++ {flags} solutions/exercise8.cpp -stdpar=gpu && ./daxpy {N}"
971901
]
972902
},
973903
{

0 commit comments

Comments
 (0)