Skip to content

Commit 754afa7

Browse files
committed
Improve recipe and build script; add mdspan to recipe
1 parent 28ba6da commit 754afa7

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

ci/recipe.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
HPCCM development container for the C++ HPC tutorial
33
https://github.com/NVIDIA/hpc-container-maker/
44
"""
5+
import platform
56
nvhpc_ver = '22.11'
67
cuda_ver = '11.8'
78
gcc_ver = '12'
@@ -10,13 +11,17 @@
1011
Stage0 += baseimage(image = f'nvcr.io/nvidia/nvhpc:{nvhpc_ver}-devel-cuda{cuda_ver}-ubuntu22.04')
1112
#Stage0 += baseimage(image = f'nvcr.io/nvidia/nvhpc:{nvhpc_ver}-devel-cuda_multi-ubuntu22.04')
1213

14+
arch = 'x86_64'
15+
if platform.machine() == 'aarch64':
16+
arch = 'aarch64'
17+
1318
Stage0 += packages(ospackages=[
1419
'libtbb-dev', # Required for GCC C++ parallel STL
15-
'python3', 'python3-pip', 'python-is-python3', 'python3-setuptools',
20+
'python3', 'python3-pip', 'python-is-python3', 'python3-setuptools', 'python3-dev',
1621
'nginx', 'zip', 'make', 'build-essential', 'curl',
1722
'git', 'bc', 'debianutils', 'libnuma1', 'openssh-client', 'wget', 'numactl',
1823
# editors
19-
'emacs', 'vim',
24+
# 'emacs', 'vim',
2025
])
2126

2227
# Install GNU and LLVM toolchains and CMake
@@ -28,29 +33,39 @@
2833
'set -ex', # Exit on first error and debug output
2934

3035
# Configure the HPC SDK toolchain to pick the latest GCC
31-
f'cd /opt/nvidia/hpc_sdk/Linux_x86_64/{nvhpc_ver}/compilers/bin/',
36+
f'cd /opt/nvidia/hpc_sdk/Linux_{arch}/{nvhpc_ver}/compilers/bin/',
3237
'makelocalrc -d . -x .',
3338

3439
# Install required python packages for the notebooks
3540
'pip install --upgrade pip',
36-
'pip install numpy matplotlib conan gdown jupyterlab ipywidgets',
41+
'pip install numpy matplotlib gdown jupyterlab ipywidgets pandas seaborn',
3742

38-
# Install latest versions of range-v3 and NVIDIA std::execution
43+
# Install latest versions of range-v3, NVIDIA std::execution, and NVTX3
3944
'mkdir -p /var/tmp',
4045
'cd /var/tmp',
41-
'git clone https://github.com/ericniebler/range-v3.git',
46+
'git clone --depth=1 https://github.com/ericniebler/range-v3.git',
4247
'cp -r range-v3/include/* /usr/include/',
4348
'rm -rf range-v3',
44-
'git clone https://github.com/nvidia/stdexec.git',
49+
'git clone --depth=1 https://github.com/nvidia/stdexec.git',
4550
'cp -r stdexec/include/* /usr/include/',
4651
'rm -rf stdexec',
52+
'git clone --depth=1 --branch=release-v3 https://github.com/NVIDIA/NVTX.git',
53+
'cp -r NVTX/c/include/nvtx3 /usr/include/nvtx3',
54+
'rm -rf NVTX',
4755
'cd -',
48-
])
4956

50-
# libc++abi : make sure clang with -stdlib=libc++ can find it
51-
Stage0 += shell(commands=[
57+
# libc++abi: make sure clang with -stdlib=libc++ can find it
5258
f'ln -sf /usr/lib/llvm-{llvm_ver}/lib/libc++abi.so.1 /usr/lib/llvm-{llvm_ver}/lib/libc++abi.so',
59+
60+
# Install HPC SDK mdspan systemwide:
61+
f'ln -sf /opt/nvidia/hpc_sdk/Linux_{arch}/{nvhpc_ver}/compilers/include/experimental/mdspan /usr/include/mdspan',
62+
f'ln -sf /opt/nvidia/hpc_sdk/Linux_{arch}/{nvhpc_ver}/compilers/include/experimental/__p0009_bits /usr/include/__p0009_bits',
63+
64+
# Put the labs include directory in the systemwide path:
65+
f'ln -sf /src/include /usr/include/labs',
5366
])
67+
68+
5469
Stage0 += environment(variables={
5570
'LD_LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LD_LIBRARY_PATH',
5671
'LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LIBRARY_PATH',
@@ -68,7 +83,7 @@
6883
# Workaround hwloc binding:
6984
'OMPI_MCA_hwloc_base_binding_policy': 'none',
7085
})
71-
Stage0 += copy(src='labs/', dest='/labs/')
86+
#Stage0 += copy(src='labs/', dest='/labs/')
7287
Stage0 += copy(src='include/cartesian_product.hpp', dest='/usr/include/cartesian_product.hpp')
7388

7489
# Install Intel's OneAPI toolchain

ci/run

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ RUN_LAB="jupyter-lab \
3939
--FileContentsManager.checkpoints_kwargs='root_dir'=/tmp \
4040
--notebook-dir=/src/labs"
4141

42+
if [ $1 = "docker-build" ] || [ $1 = "singularity-build" ]; then
43+
if ! command -v hpccm ; then
44+
echo "hpccm not found"
45+
echo "It can be installed as a python package via 'pip install hpccm'"
46+
echo "If it is already installed make sure it is in the PATH"
47+
exit 1
48+
fi
49+
fi
50+
4251
case $1 in
4352
# Docker:
4453
docker-build)
@@ -50,7 +59,7 @@ case $1 in
5059
docker-serve)
5160
mkdir -p target/local
5261
docker run \
53-
-p ${PORT}:8888 \
62+
-p ${PORT}:${PORT} \
5463
-v "$(pwd)/target/local":"/.local" \
5564
$DOCKER_CMDS \
5665
bash -c "$RUN_LAB"

0 commit comments

Comments
 (0)