Skip to content

Commit 4bf0845

Browse files
committed
Add mdspan exercise and update to HPC SDK 23.5
1 parent 754afa7 commit 4bf0845

File tree

15 files changed

+754
-77
lines changed

15 files changed

+754
-77
lines changed

ci/recipe.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
https://github.com/NVIDIA/hpc-container-maker/
44
"""
55
import platform
6-
nvhpc_ver = '22.11'
7-
cuda_ver = '11.8'
6+
nvhpc_ver = '23.5'
7+
cuda_ver = '12.1'
88
gcc_ver = '12'
9-
llvm_ver = '16'
9+
llvm_ver = '17'
1010

1111
Stage0 += baseimage(image = f'nvcr.io/nvidia/nvhpc:{nvhpc_ver}-devel-cuda{cuda_ver}-ubuntu22.04')
12-
#Stage0 += baseimage(image = f'nvcr.io/nvidia/nvhpc:{nvhpc_ver}-devel-cuda_multi-ubuntu22.04')
1312

1413
arch = 'x86_64'
1514
if platform.machine() == 'aarch64':

ci/run

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PORT=8888
99
DOCKER_CMDS="\
1010
--gpus=all \
1111
--privileged \
12+
--ulimit memlock=-1 \
1213
-u $(id -u):$(id -g) \
1314
-h $(hostname) \
1415
-v $(pwd):/src \
@@ -29,7 +30,7 @@ SING_CMDS="\
2930

3031
#RUN_LAB="source /opt/intel/oneapi/setvars.sh intel64 && jupyter-lab \
3132

32-
RUN_LAB="jupyter-lab \
33+
RUN_LAB="source /opt/nvidia/hpc_sdk/Linux_x86_64/23.5/comm_libs/12.1/hpcx/latest/hpcx-mt-init.sh && hpcx_load && jupyter-lab \
3334
--no-browser \
3435
--allow-root \
3536
--ip=0.0.0.0 \

labs/lab1_daxpy/daxpy.ipynb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@
8585
"metadata": {},
8686
"outputs": [],
8787
"source": [
88-
"!g++ -std=c++11 -o daxpy starting_point.cpp\n",
88+
"!g++ -std=c++20 -o daxpy starting_point.cpp\n",
8989
"!./daxpy 1000000"
9090
]
9191
},
9292
{
9393
"cell_type": "markdown",
9494
"metadata": {},
9595
"source": [
96-
"Here the `-std=c++11` controls the C++ language version.\n",
96+
"Here the `-std=c++20` controls the C++ language version.\n",
9797
"\n",
9898
"Let's try again with optimizations using `-Ofast`, disabling debug checks `-DNDEBUG`, and compiling for the current CPU using `-march=native`:"
9999
]
@@ -104,7 +104,7 @@
104104
"metadata": {},
105105
"outputs": [],
106106
"source": [
107-
"!g++ -std=c++11 -Ofast -march=native -DNDEBUG -o daxpy starting_point.cpp\n",
107+
"!g++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy starting_point.cpp\n",
108108
"!./daxpy 10000000"
109109
]
110110
},
@@ -192,7 +192,7 @@
192192
"metadata": {},
193193
"outputs": [],
194194
"source": [
195-
"!g++ -std=c++17 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
195+
"!g++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
196196
"!./daxpy 1000000"
197197
]
198198
},
@@ -202,7 +202,7 @@
202202
"metadata": {},
203203
"outputs": [],
204204
"source": [
205-
"!clang++ -std=c++17 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
205+
"!clang++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
206206
"!./daxpy 1000000"
207207
]
208208
},
@@ -212,7 +212,7 @@
212212
"metadata": {},
213213
"outputs": [],
214214
"source": [
215-
"!nvc++ -std=c++17 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
215+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise1.cpp\n",
216216
"!./daxpy 1000000"
217217
]
218218
},
@@ -285,7 +285,7 @@
285285
"metadata": {},
286286
"outputs": [],
287287
"source": [
288-
"!nvc++ -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy exercise2.cpp\n",
288+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy exercise2.cpp\n",
289289
"!./daxpy 1000000"
290290
]
291291
},
@@ -329,7 +329,7 @@
329329
"metadata": {},
330330
"outputs": [],
331331
"source": [
332-
"!nvc++ -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy solutions/exercise2.cpp\n",
332+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -o daxpy solutions/exercise2.cpp\n",
333333
"!./daxpy 1000000"
334334
]
335335
},
@@ -405,7 +405,7 @@
405405
"metadata": {},
406406
"outputs": [],
407407
"source": [
408-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy exercise3.cpp\n",
408+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o daxpy exercise3.cpp\n",
409409
"!./daxpy 1000000"
410410
]
411411
},
@@ -415,7 +415,7 @@
415415
"metadata": {},
416416
"outputs": [],
417417
"source": [
418-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy exercise3.cpp\n",
418+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o daxpy exercise3.cpp\n",
419419
"!./daxpy 1000000"
420420
]
421421
},
@@ -462,17 +462,19 @@
462462
"metadata": {},
463463
"outputs": [],
464464
"source": [
465-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy solutions/exercise3.cpp\n",
465+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o daxpy solutions/exercise3.cpp\n",
466466
"!./daxpy 1000000"
467467
]
468468
},
469469
{
470470
"cell_type": "code",
471471
"execution_count": null,
472-
"metadata": {},
472+
"metadata": {
473+
"tags": []
474+
},
473475
"outputs": [],
474476
"source": [
475-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o daxpy solutions/exercise3.cpp\n",
477+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o daxpy solutions/exercise3.cpp\n",
476478
"!./daxpy 1000000"
477479
]
478480
}

labs/lab1_select/select.ipynb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"metadata": {},
7777
"outputs": [],
7878
"source": [
79-
"!nvc++ -std=c++20 -O4 -fast -tp=native -Mllvm-fast -DNDEBUG -Mllvm-fast -o select exercise1.cpp\n",
79+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -o select exercise1.cpp\n",
8080
"!./select 30"
8181
]
8282
},
@@ -123,7 +123,7 @@
123123
"metadata": {},
124124
"outputs": [],
125125
"source": [
126-
"!nvc++ -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select solutions/exercise1.cpp\n",
126+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -o select solutions/exercise1.cpp\n",
127127
"!./select 30"
128128
]
129129
},
@@ -171,7 +171,7 @@
171171
"metadata": {},
172172
"outputs": [],
173173
"source": [
174-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select exercise2.cpp\n",
174+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o select exercise2.cpp\n",
175175
"!./select 30"
176176
]
177177
},
@@ -181,7 +181,7 @@
181181
"metadata": {},
182182
"outputs": [],
183183
"source": [
184-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select exercise2.cpp\n",
184+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o select exercise2.cpp\n",
185185
"!./select 30"
186186
]
187187
},
@@ -224,7 +224,7 @@
224224
"metadata": {},
225225
"outputs": [],
226226
"source": [
227-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select solutions/exercise2.cpp\n",
227+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o select solutions/exercise2.cpp\n",
228228
"!./select 30"
229229
]
230230
},
@@ -234,7 +234,7 @@
234234
"metadata": {},
235235
"outputs": [],
236236
"source": [
237-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select solutions/exercise2.cpp\n",
237+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o select solutions/exercise2.cpp\n",
238238
"!./select 30"
239239
]
240240
},
@@ -298,7 +298,7 @@
298298
"metadata": {},
299299
"outputs": [],
300300
"source": [
301-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select exercise3.cpp\n",
301+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o select exercise3.cpp\n",
302302
"!./select 30"
303303
]
304304
},
@@ -308,7 +308,7 @@
308308
"metadata": {},
309309
"outputs": [],
310310
"source": [
311-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select exercise3.cpp\n",
311+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o select exercise3.cpp\n",
312312
"!./select 30"
313313
]
314314
},
@@ -351,17 +351,19 @@
351351
"metadata": {},
352352
"outputs": [],
353353
"source": [
354-
"!nvc++ -stdpar=multicore -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select solutions/exercise3.cpp\n",
354+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=multicore -o select solutions/exercise3.cpp\n",
355355
"!./select 10000000"
356356
]
357357
},
358358
{
359359
"cell_type": "code",
360360
"execution_count": null,
361-
"metadata": {},
361+
"metadata": {
362+
"tags": []
363+
},
362364
"outputs": [],
363365
"source": [
364-
"!nvc++ -stdpar=gpu -std=c++20 -O4 -fast -march=native -Mllvm-fast -DNDEBUG -o select solutions/exercise3.cpp\n",
366+
"!nvc++ -std=c++20 -Ofast -march=native -DNDEBUG -stdpar=gpu -o select solutions/exercise3.cpp\n",
365367
"!./select 10000000"
366368
]
367369
}

labs/lab2_heat/exercise1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) {
149149
MPI_File_iwrite_at(f, 2 * sizeof(long), &time, 1, MPI_DOUBLE, &req[2]);
150150
}
151151
auto values_offset = header_bytes + p.rank * values_bytes_per_rank;
152-
MPI_File_iwrite_at(f, values_offset, u_new.data() + p.ny, values_per_rank, MPI_DOUBLE, &req[0]);
152+
MPI_File_iwrite_at(f, values_offset, u_old.data() + p.ny, values_per_rank, MPI_DOUBLE, &req[0]);
153153
MPI_Waitall(p.rank == 0 ? 3 : 1, req, MPI_STATUSES_IGNORE);
154154
MPI_File_close(&f);
155155

0 commit comments

Comments
 (0)