-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from nextsimhub/issue69_docker
Adds a docker image for the domain decomp tool
- Loading branch information
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Build stage with Spack pre-installed and ready to be used | ||
FROM spack/ubuntu-jammy:0.21 AS builder | ||
|
||
# Install software from spack_devenv.yaml | ||
RUN mkdir /opt/spack-environment | ||
COPY spack.yaml /opt/spack-environment/spack.yaml | ||
RUN cd /opt/spack-environment \ | ||
&& spack env activate . \ | ||
&& spack install --fail-fast \ | ||
&& spack gc -y | ||
|
||
# Strip all the binaries | ||
RUN find -L /opt/views/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 | ||
|
||
# Modifications to the environment that are necessary to run | ||
RUN cd /opt/spack-environment && \ | ||
spack env activate --sh -d . > activate.sh | ||
|
||
# Copy and compile domain_decomp | ||
COPY . /decomp | ||
RUN spack env activate /opt/spack-environment \ | ||
&& cd /decomp \ | ||
&& BUILD_DIR=`mktemp -d` \ | ||
&& cmake -G "Unix Makefiles" -B$BUILD_DIR -S. \ | ||
&& cmake --build $BUILD_DIR --config Release \ | ||
&& cp $BUILD_DIR/decomp /usr/bin/ | ||
|
||
# Bare OS image to run the installed executables | ||
FROM ubuntu:22.04 | ||
|
||
# Copy necessary files from the builder stage | ||
COPY --from=builder /opt/spack-environment /opt/spack-environment | ||
COPY --from=builder /opt/software /opt/software | ||
COPY --from=builder /decomp /decomp | ||
COPY --from=builder /usr /usr | ||
# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it | ||
COPY --from=builder /opt/views /opt/views | ||
RUN ln -s /opt/views/view /opt/view | ||
|
||
# Copy and set entrypoint | ||
COPY entrypoint.sh / | ||
RUN chmod a+x /entrypoint.sh | ||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
|
||
# Set volume mount point for I/O | ||
RUN mkdir /io | ||
VOLUME /io | ||
WORKDIR /io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# | ||
# Entry point script for a docker image that simply runs the domain decomposition tool, e.g | ||
# docker build . -t domain_decomp && docker run --rm -v $PWD:/io domain_decomp 8 -g testgrid.nc | ||
|
||
. /opt/spack-environment/activate.sh | ||
|
||
NP=$1; shift | ||
|
||
case $NP in | ||
''|*[!0-9]*) | ||
echo "Provide the number of domains before any options" | ||
exec decomp --help | ||
exit 15 | ||
;; | ||
*) mpirun --allow-run-as-root -n $NP --oversubscribe decomp "$@" ;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
spack: | ||
packages: | ||
all: | ||
compiler: [[email protected]] | ||
specs: | ||
- [email protected]+log+program_options | ||
- '[email protected]:' | ||
- gmake | ||
- [email protected]+mpi+parallel-netcdf | ||
- [email protected] | ||
- zoltan | ||
concretizer: | ||
unify: true | ||
config: | ||
install_missing_compilers: true | ||
install_tree: /opt/software | ||
view: /opt/views/view |