Merge pull request #1725 from Shimwell/adding_optional_dagmc_to_docker

Adding optional dagmc to docker
This commit is contained in:
Patrick Shriwise 2021-01-02 16:55:31 -06:00 committed by GitHub
commit 32918f042d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 234 additions and 6 deletions

View file

@ -0,0 +1,35 @@
name: dockerhub-publish-latest-dagmc
on:
push:
branches: master
jobs:
main:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: openmc/openmc:latest-dagmc
build-args: |
include_dagmc=true
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -27,6 +27,8 @@ jobs:
with:
push: true
tags: openmc/openmc:develop
build-args: |
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -0,0 +1,38 @@
name: dockerhub-publish-release-dagmc
on:
push:
tags: 'v*.*.*'
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}-dagmc
build-args: |
include_dagmc=true
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -30,6 +30,8 @@ jobs:
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}
build-args: |
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -27,6 +27,8 @@ jobs:
with:
push: true
tags: openmc/openmc:latest
build-args: |
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -0,0 +1,35 @@
name: dockerhub-publish-develop-dagmc
on:
push:
branches: develop
jobs:
main:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: openmc/openmc:develop-dagmc
build-args: |
include_dagmc=true
compile_cores=2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -1,5 +1,20 @@
# To build with OpenMC
# docker build -t openmc .
# To build with OpenMC and DAGMC enabled
# docker build -t openmc_dagmc --build-arg include_dagmc=true .
# To make use of multiple cores during the compile stages of the docker build
# docker build -t openmc_dagmc --build-arg compile_cores=8 .
FROM ubuntu:latest
# By default this Dockerfile builds OpenMC without dagmc
ARG include_dagmc=false
# By default one core is used to compile
ARG compile_cores=1
# Setup environment variables for Docker image
ENV CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \
PATH=/opt/openmc/bin:/opt/NJOY2016/build:$PATH \
@ -26,12 +41,111 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \
mkdir build && cd build && \
cmake -Dstatic=on .. && make 2>/dev/null && make install
# Clone and install OpenMC
RUN git clone --recurse-submodules https://github.com/openmc-dev/openmc.git \
/opt/openmc && cd /opt/openmc && mkdir -p build && cd build && \
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
make && make install && \
cd .. && pip install -e .[test]
# Clone and install OpenMC without DAGMC
RUN if [ "$include_dagmc" = "false" ] ; \
then git clone --recurse-submodules https://github.com/openmc-dev/openmc.git ; \
/opt/openmc ; \
cd /opt/openmc ; \
mkdir -p build ; \
cd build ; \
cmake -Doptimize=on \
-DHDF5_PREFER_PARALLEL=on .. ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
cd .. ; \
pip install -e .[test] ; \
fi
# install addition packages required for DAGMC
RUN if [ "$include_dagmc" = "true" ] ; \
then apt-get --yes install libeigen3-dev ; \
apt-get --yes install libnetcdf-dev ; \
apt-get --yes install libtbb-dev ; \
apt-get --yes install libglfw3-dev ; \
fi
# Clone and install Embree
RUN if [ "$include_dagmc" = "true" ] ; \
then git clone https://github.com/embree/embree ; \
cd embree ; \
mkdir build ; \
cd build ; \
cmake .. -DCMAKE_INSTALL_PREFIX=.. \
-DEMBREE_ISPC_SUPPORT=OFF ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
# Clone and install MOAB
RUN if [ "$include_dagmc" = "true" ] ; \
then pip install --upgrade numpy cython ; \
mkdir MOAB ; \
cd MOAB ; \
mkdir build ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab/ ; \
cd build ; \
cmake ../moab -DENABLE_HDF5=ON \
-DENABLE_NETCDF=ON \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_FORTRAN=OFF \
-DENABLE_BLASLAPACK=OFF ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
rm -rf * ; \
cmake ../moab -DBUILD_SHARED_LIBS=ON \
-DENABLE_HDF5=ON \
-DENABLE_PYMOAB=ON \
-DENABLE_BLASLAPACK=OFF \
-DENABLE_FORTRAN=OFF \
-DENABLE_BLASLAPACK=OFF ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
# Clone and install Double-Down
RUN if [ "$include_dagmc" = "true" ] ; \
then git clone https://github.com/pshriwise/double-down ; \
cd double-down ; \
mkdir build ; \
cd build ; \
cmake .. -DCMAKE_INSTALL_PREFIX=.. \
-DMOAB_DIR=/usr/local \
-DEMBREE_DIR=/embree/lib/cmake/embree-3.12.1 ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
# Clone and install DAGMC
RUN if [ "$include_dagmc" = "true" ] ; \
then mkdir DAGMC ; \
cd DAGMC ; \
git clone -b develop https://github.com/svalinn/dagmc ; \
mkdir build ; \
cd build ; \
cmake ../dagmc -DBUILD_TALLY=ON \
-DCMAKE_INSTALL_PREFIX=/dagmc/ \
-DMOAB_DIR=/usr/local \
-DBUILD_STATIC_LIBS=OFF \
-DBUILD_STATIC_EXE=OFF ; \
make -j"$compile_cores" install ; \
rm -rf /DAGMC/dagmc /DAGMC/build ; \
fi
# Clone and install OpenMC with DAGMC
RUN if [ "$include_dagmc" = "true" ] ; \
then git clone --recurse-submodules https://github.com/openmc-dev/openmc.git /opt/openmc ; \
cd /opt/openmc ; \
mkdir build ; \
cd build ; \
cmake -Doptimize=on \
-Ddagmc=ON \
-DDAGMC_DIR=/DAGMC/ \
-DHDF5_PREFER_PARALLEL=on .. ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
cd .. ; \
pip install -e .[test] ; \
fi
# Download cross sections (NNDC and WMP) and ENDF data needed by test suite
RUN /opt/openmc/tools/ci/download-xs.sh