forked from JCSDA/spack-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-ubuntu-gcc-openmpi.yaml
193 lines (180 loc) · 5.22 KB
/
docker-ubuntu-gcc-openmpi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
spack:
concretizer:
unify: true
view: false
config:
checksum: false
build_jobs: 2
connect_timeout: 60
compilers:
- compiler:
spec: gcc@9.4.0
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
flags: {}
operating_system: ubuntu20.04
modules: []
environment: {}
extra_rpaths: []
# Basic package config from configs/common/packages.yaml
# Additional package config for container
packages:
all:
require: '%gcc'
target: [x86_64]
providers:
mpi: [openmpi@4.1.5]
compiler: [gcc@9.4.0]
gcc:
buildable: false
externals:
- spec: gcc@9.4.0
prefix: /usr
diffutils:
buildable: false
externals:
- spec: diffutils@3.7
prefix: /usr
git:
buildable: false
externals:
- spec: git@2.25.1~tcltk
prefix: /usr
git-lfs:
buildable: false
externals:
- spec: git-lfs@2.9.2
prefix: /usr
mysql:
buildable: false
externals:
- spec: mysql@8.0.32
prefix: /usr
qt:
buildable: false
externals:
- spec: qt@5.12.8
prefix: /usr
version: [5.15.3]
wget:
buildable: false
externals:
- spec: wget@1.20.3
prefix: /usr
version: [1.21.2]
specs: []
container:
# Select the format of the recipe e.g. docker,
# singularity or anything else that is currently supported
format: docker
# How to use:
#$ spack containerize > Dockerfile
#$ sudo docker build -t myimage .
#$ sudo docker run -it myimage
#format: singularity
# How to use:
#$ spack containerize > singularity.def
#$ sudo singularity build singularity.sif singularity.def
# Sets the base images for the stages where Spack builds the
# software or where the software gets installed after being built..
images:
os: ubuntu:20.04
spack:
url: https://github.com/jcsda/spack
ref: spack-stack-1.4.1
resolve_sha: false
# Whether or not to strip binaries
strip: false
## Additional system packages that are needed at runtime
os_packages:
build:
- bc
- cpp
- g++
- gcc
- gfortran
- git
- git-lfs
- make
- mysql-server
- qt5-default
- libqt5svg5-dev
- qt5dxcb-plugin
- wget
final:
- bc
- cpp
- g++
- gcc
- gfortran
- git
- git-lfs
- make
- mysql-server
- qt5-default
- libqt5svg5-dev
- qt5dxcb-plugin
- wget
# Implicitly included in build step
- build-essential
- ca-certificates
- curl
- file
- gnupg2
- iproute2
- locales
- python3
- python3-pip
- python3-setuptools
- unzip
- vim
# Extra instructions
extra_instructions:
pre_final: |
#Set environment variables for installing tzdata
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV CC=gcc
ENV CXX=g++
ENV FC=gfortran
build: |
# Put output of spack find into a file
RUN cd /opt/spack-environment && \
spack env activate -d . && \
spack find 2>&1 | tee /root/spack_find.out
final: |
# Copy spack find output from builder
COPY --from=builder /root/spack_find.out /root/spack_find.out
# Make a non-root user:nonroot / group:nonroot for running MPI
RUN useradd -U -k /etc/skel -s /bin/bash -d /home/nonroot -m nonroot --uid 43891 && \
echo "ulimit -s unlimited" >> /home/nonroot/.bashrc && \
echo "ulimit -v unlimited" >> /home/nonroot/.bashrc && \
echo "export CC=gcc" >> /home/nonroot/.bashrc && \
echo "export CXX=g++" >> /home/nonroot/.bashrc && \
echo "export FC=gfortran" >> /home/nonroot/.bashrc && \
printf "[credential]\n helper = cache --timeout=7200\n" >> /home/nonroot/.gitconfig && \
mkdir /home/nonroot/.openmpi && \
echo "rmaps_base_oversubscribe = 1" >> /home/nonroot/.openmpi/mca-params.conf && \
chown -R nonroot:nonroot /home/nonroot/.gitconfig /home/nonroot/.openmpi
# Replicate settings for root user
RUN echo "ulimit -s unlimited" >> /root/.bashrc && \
echo "ulimit -v unlimited" >> /root/.bashrc && \
echo "export CC=gcc" >> /root/.bashrc && \
echo "export CXX=g++" >> /root/.bashrc && \
echo "export FC=gfortran" >> /root/.bashrc && \
printf "[credential]\n helper = cache --timeout=7200\n" >> /root/.gitconfig && \
mkdir /root/.openmpi && \
echo "rmaps_base_oversubscribe = 1" >> /root/.openmpi/mca-params.conf
# Also set necessary environment variables for openmpi
RUN echo "export OMPI_ALLOW_RUN_AS_ROOT=1" >> /root/.bashrc && \
echo "export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1" >> /root/.bashrc && \
echo "export OMPI_MCA_rmaps_base_oversubscribe=1" >> /root/.bashrc
# Source spack environment script for root
RUN echo "source /etc/profile.d/z10_spack_environment.sh\n" >> /root/.bashrc
# Labels for the image
labels:
app: ""
mpi: "openmpi"