|
6 | 6 | import platform |
7 | 7 | from hpccm.primitives import raw |
8 | 8 |
|
| 9 | +tutorial = 'stdpar' |
9 | 10 | ubuntu_ver = '22.04' |
10 | 11 | nvhpc_ver = '24.3' |
11 | 12 | cuda_ver = '12.3' |
|
17 | 18 |
|
18 | 19 | Stage0 += baseimage(image=f'nvcr.io/nvidia/nvhpc:{nvhpc_ver}-devel-cuda{cuda_ver}-ubuntu{ubuntu_ver}') |
19 | 20 |
|
20 | | -Stage0 += copy(src='.', dest='/accelerated-computing-hub') |
21 | | -Stage0 += copy(src='brev/update-git-branch.bash', dest='/update-git-branch.bash') |
| 21 | +Stage0 += raw(docker='ARG GIT_BRANCH_NAME') |
22 | 22 |
|
23 | | -Stage0 += workdir(directory=f'/accelerated-computing-hub/tutorials/stdpar/notebooks') |
| 23 | +Stage0 += environment(variables={ |
| 24 | + 'GIT_BRANCH_NAME': '${GIT_BRANCH_NAME}', |
| 25 | + |
| 26 | + 'ACH_STDPAR_NVHPC_VERSION': nvhpc_ver, |
| 27 | + 'ACH_STDPAR_CUDA_VERSION': cuda_ver, |
| 28 | + 'ACH_STDPAR_ARCH': arch, |
| 29 | + |
| 30 | + 'ACPP_APPDB_DIR': '/accelerated-computing-hub/', |
| 31 | + |
| 32 | + 'PATH': '$PATH:/opt/adaptivecpp/bin', |
| 33 | + 'LD_LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LD_LIBRARY_PATH', |
| 34 | + 'LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LIBRARY_PATH', |
| 35 | + |
| 36 | + # Silence pip warnings about running as root |
| 37 | + 'PIP_ROOT_USER_ACTION': 'ignore', |
| 38 | + |
| 39 | + # Simplify running HPC-X on systems without InfiniBand |
| 40 | + 'OMPI_MCA_coll_hcoll_enable': '0', |
| 41 | + |
| 42 | + # We do not need VFS for the exercises, and using it from a container in a 'generic' way is not trivial: |
| 43 | + 'UCX_VFS_ENABLE': 'n', |
| 44 | + |
| 45 | + # Allow HPC-X to oversubscribe the CPU with more ranks than cores without using mpirun --oversubscribe |
| 46 | + 'OMPI_MCA_rmaps_base_oversubscribe' : 'true', |
| 47 | + |
| 48 | + # Select matplotdir config directory to silence warning |
| 49 | + 'MPLCONFIGDIR': '/tmp/matplotlib', |
| 50 | + |
| 51 | + # Allow OpenMPI to run as root: |
| 52 | + 'OMPI_ALLOW_RUN_AS_ROOT': '1', |
| 53 | + 'OMPI_ALLOW_RUN_AS_ROOT_CONFIRM': '1', |
| 54 | + |
| 55 | + # Workaround hwloc binding: |
| 56 | + 'OMPI_MCA_hwloc_base_binding_policy': 'none', |
| 57 | + |
| 58 | + # Workaround nvfortran limit of 64k thread blocks |
| 59 | + 'NVCOMPILER_ACC_GANGLIMIT': '67108864', # (1 << 26) |
| 60 | +}) |
24 | 61 |
|
25 | 62 | Stage0 += packages(ospackages=[ |
26 | 63 | 'libtbb-dev', # Required for GCC C++ parallel algorithms |
|
45 | 82 | # Install CMake |
46 | 83 | Stage0 += cmake(eula=True, version=cmake_ver) |
47 | 84 |
|
| 85 | +# Copy only requirements.txt first for better Docker layer caching. |
| 86 | +Stage0 += copy(src=f'tutorials/{tutorial}/brev/requirements.txt', dest='/opt/requirements.txt') |
| 87 | + |
48 | 88 | Stage0 += shell(commands=[ |
49 | 89 | 'set -ex', # Exit on first error and debug output |
50 | 90 |
|
|
55 | 95 |
|
56 | 96 | # Install python packages |
57 | 97 | 'pip install --upgrade pip', |
58 | | - f'pip install --root-user-action=ignore -r /accelerated-computing-hub/tutorials/stdpar/brev/requirements.txt', |
| 98 | + f'pip install --root-user-action=ignore -r /opt/requirements.txt', |
59 | 99 |
|
60 | 100 | # Build and install AdaptiveCpp |
61 | 101 | 'git clone --depth=1 --shallow-submodules --recurse-submodules -b develop https://github.com/AdaptiveCpp/AdaptiveCpp', |
|
109 | 149 | 'python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements"', |
110 | 150 | ]) |
111 | 151 |
|
112 | | -Stage0 += raw(docker='ARG GIT_BRANCH_NAME') |
113 | | - |
114 | | -Stage0 += environment(variables={ |
115 | | - 'GIT_BRANCH_NAME': '${GIT_BRANCH_NAME}', |
116 | | - |
117 | | - 'ACH_STDPAR_NVHPC_VERSION': nvhpc_ver, |
118 | | - 'ACH_STDPAR_CUDA_VERSION': cuda_ver, |
119 | | - 'ACH_STDPAR_ARCH': arch, |
120 | | - |
121 | | - 'ACPP_APPDB_DIR': '/accelerated-computing-hub/', |
122 | | - |
123 | | - 'PATH': '$PATH:/opt/adaptivecpp/bin', |
124 | | - 'LD_LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LD_LIBRARY_PATH', |
125 | | - 'LIBRARY_PATH': f'/usr/lib/llvm-{llvm_ver}/lib:$LIBRARY_PATH', |
126 | | - |
127 | | - # Silence pip warnings about running as root |
128 | | - 'PIP_ROOT_USER_ACTION': 'ignore', |
129 | | - |
130 | | - # Simplify running HPC-X on systems without InfiniBand |
131 | | - 'OMPI_MCA_coll_hcoll_enable': '0', |
132 | | - |
133 | | - # We do not need VFS for the exercises, and using it from a container in a 'generic' way is not trivial: |
134 | | - 'UCX_VFS_ENABLE': 'n', |
135 | | - |
136 | | - # Allow HPC-X to oversubscribe the CPU with more ranks than cores without using mpirun --oversubscribe |
137 | | - 'OMPI_MCA_rmaps_base_oversubscribe' : 'true', |
138 | | - |
139 | | - # Select matplotdir config directory to silence warning |
140 | | - 'MPLCONFIGDIR': '/tmp/matplotlib', |
141 | | - |
142 | | - # Allow OpenMPI to run as root: |
143 | | - 'OMPI_ALLOW_RUN_AS_ROOT': '1', |
144 | | - 'OMPI_ALLOW_RUN_AS_ROOT_CONFIRM': '1', |
145 | | - |
146 | | - # Workaround hwloc binding: |
147 | | - 'OMPI_MCA_hwloc_base_binding_policy': 'none', |
| 152 | +Stage0 += copy(src='.', dest='/accelerated-computing-hub') |
| 153 | +Stage0 += copy(src='brev/update-git-branch.bash', dest='/opt/update-git-branch.bash') |
148 | 154 |
|
149 | | - # Workaround nvfortran limit of 64k thread blocks |
150 | | - 'NVCOMPILER_ACC_GANGLIMIT': '67108864', # (1 << 26) |
151 | | -}) |
| 155 | +Stage0 += workdir(directory=f'/accelerated-computing-hub/tutorials/{tutorial}/notebooks') |
152 | 156 |
|
153 | 157 | Stage0 += raw(docker='ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"]') |
0 commit comments