Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Singularity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMGW
Singularity
Commits
96265eb6
Commit
96265eb6
authored
2 years ago
by
Michael Blaschek
Browse files
Options
Downloads
Patches
Plain Diff
containerized development
parent
2b0520b5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
development/README.md
+143
-0
143 additions, 0 deletions
development/README.md
development/Singularity.hdf5.1.10.7
+56
-0
56 additions, 0 deletions
development/Singularity.hdf5.1.10.7
development/spack.yaml
+22
-0
22 additions, 0 deletions
development/spack.yaml
with
221 additions
and
0 deletions
development/README.md
0 → 100644
+
143
−
0
View file @
96265eb6
# Development Containers
We are going to use spack to build a container with different libraries and headers inside and will produce different stages.
## Define a spack configuration
We can choose some libraries and version that we need and build it into a concise image.
This needs to be in a file called spack.yaml
```
yaml
spack
:
specs
:
-
hdf5@1.10.7+mpi target=skylake_avx512
-
openmpi@3.1.6 target=skylake_avx512
container
:
images
:
os
:
"
centos:8"
spack
:
0.17.2
format
:
singularity
strip
:
true
os_packages
:
final
:
-
gcc
-
gcc-gfortran
labels
:
app
:
"
hdf5@1.10.7+mpi"
mpi
:
"
openmpi@3.1.6"
```
micro architectures known to spack:
```
Generic architectures (families)
aarch64 arm ppc ppc64 ppc64le ppcle riscv64 sparc sparc64 x86 x86_64 x86_64_v2 x86_64_v3 x86_64_v4
GenuineIntel - x86
i686 pentium2 pentium3 pentium4 prescott
GenuineIntel - x86_64
nocona nehalem sandybridge haswell skylake cannonlake cascadelake
core2 westmere ivybridge broadwell mic_knl skylake_avx512 icelake
AuthenticAMD - x86_64
k10 bulldozer piledriver zen steamroller zen2 zen3 excavator
IBM - ppc64
power7 power8 power9
IBM - ppc64le
power8le power9le
Cavium - aarch64
thunderx2
Fujitsu - aarch64
a64fx
ARM - aarch64
graviton graviton2
Apple - aarch64
m1
SiFive - riscv64
u74mc
```
convert this configuration into a singularity (apptainer) recipes
```
bash
spack containerize
>
Singularity.hdf5.1.10.7
```
which has the following content
```
singularity
Bootstrap: docker
From: spack/centos7:0.16.3
Stage: build
%post
# Create the manifest file for the installation in /opt/spack-environment
mkdir /opt/spack-environment && cd /opt/spack-environment
cat << EOF > spack.yaml
spack:
specs:
- hdf5@1.10.7+mpi
- openmpi@3.6.1
concretization: together
config:
install_tree: /opt/software
view: /opt/view
EOF
# Install all the required software
. /opt/spack/share/spack/setup-env.sh
spack env activate .
spack install --fail-fast
spack gc -y
spack env deactivate
spack env activate --sh -d . >> /opt/spack-environment/environment_modifications.sh
# Strip the binaries to reduce the size of the image
find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s
Bootstrap: docker
From: centos:7
Stage: final
%files from build
/opt/spack-environment /opt
/opt/software /opt
/opt/view /opt
/opt/spack-environment/environment_modifications.sh /opt/spack-environment/environment_modifications.sh
%post
# Update, install and cleanup of system packages needed at run-time
yum update -y && yum install -y epel-release && yum update -y
yum install -y gcc gcc-gfortran
rm -rf /var/cache/yum && yum clean all
# Modify the environment without relying on sourcing shell specific files at startup
cat /opt/spack-environment/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
%labels
app hdf5@1.10.7+mpi
mpi openmpi@3.6.1
```
Then we can use that recipes to build a singularity container:
```
bash
singularity build hdf5.1.10.7.sif Singularity.hdf5.1.10.7
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
development/Singularity.hdf5.1.10.7
0 → 100644
+
56
−
0
View file @
96265eb6
Bootstrap: docker
From: spack/ubuntu-bionic:0.16.3
Stage: build
%post
# Create the manifest file for the installation in /opt/spack-environment
mkdir /opt/spack-environment && cd /opt/spack-environment
cat << EOF > spack.yaml
spack:
specs:
- hdf5@1.10.7+mpi
- openmpi@3.1.6
concretization: together
config:
install_tree: /opt/software
view: /opt/view
EOF
# Install all the required software
. /opt/spack/share/spack/setup-env.sh
spack env activate .
spack install --fail-fast
spack gc -y
spack env deactivate
spack env activate --sh -d . >> /opt/spack-environment/environment_modifications.sh
# Strip the binaries to reduce the size of the image
find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s
Bootstrap: docker
From: ubuntu:18.04
Stage: final
%files from build
/opt/spack-environment /opt
/opt/software /opt
/opt/view /opt
/opt/spack-environment/environment_modifications.sh /opt/spack-environment/environment_modifications.sh
%post
# Update, install and cleanup of system packages needed at run-time
apt-get -yqq update && apt-get -yqq upgrade
apt-get -yqq install gcc gfortran
rm -rf /var/lib/apt/lists/*
# Modify the environment without relying on sourcing shell specific files at startup
cat /opt/spack-environment/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
%labels
app hdf5@1.10.7+mpi
mpi openmpi@3.1.6
This diff is collapsed.
Click to expand it.
development/spack.yaml
0 → 100644
+
22
−
0
View file @
96265eb6
spack
:
specs
:
-
hdf5@1.10.7+mpi target=skylake
-
openmpi@3.1.6 target=skylake
container
:
images
:
os
:
"
ubuntu:18.04"
spack
:
0.16.3
format
:
singularity
strip
:
true
os_packages
:
final
:
-
gcc
-
gcc-gfortran
labels
:
app
:
"
hdf5@1.10.7+mpi"
mpi
:
"
openmpi@3.1.6"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment