diff --git a/.github/workflows/dockerhub-publish-dagmc-libmesh.yml b/.github/workflows/dockerhub-publish-dagmc-libmesh.yml new file mode 100644 index 0000000000..5a72475a90 --- /dev/null +++ b/.github/workflows/dockerhub-publish-dagmc-libmesh.yml @@ -0,0 +1,36 @@ +name: dockerhub-publish-latest-dagmc-libmesh + +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-libmesh + build-args: | + build_dagmc=on + build_libmesh=on + compile_cores=2 + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-dagmc.yml b/.github/workflows/dockerhub-publish-dagmc.yml index d962292795..663e1fd17d 100644 --- a/.github/workflows/dockerhub-publish-dagmc.yml +++ b/.github/workflows/dockerhub-publish-dagmc.yml @@ -28,7 +28,7 @@ jobs: push: true tags: openmc/openmc:latest-dagmc build-args: | - include_dagmc=true + build_dagmc=on compile_cores=2 - name: Image digest diff --git a/.github/workflows/dockerhub-publish-dev.yml b/.github/workflows/dockerhub-publish-dev.yml index 73f62acaa2..a08d13e5ae 100644 --- a/.github/workflows/dockerhub-publish-dev.yml +++ b/.github/workflows/dockerhub-publish-dev.yml @@ -29,6 +29,7 @@ jobs: tags: openmc/openmc:develop build-args: | compile_cores=2 + openmc_branch=develop - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-develop-dagmc-libmesh.yml b/.github/workflows/dockerhub-publish-develop-dagmc-libmesh.yml new file mode 100644 index 0000000000..1a5799f1aa --- /dev/null +++ b/.github/workflows/dockerhub-publish-develop-dagmc-libmesh.yml @@ -0,0 +1,37 @@ +name: dockerhub-publish-develop-dagmc-libmesh + +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: | + build_dagmc=on + build_libmesh=on + compile_cores=2 + openmc_branch=develop + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-develop-dagmc.yml b/.github/workflows/dockerhub-publish-develop-dagmc.yml index 0ded0c180e..b98b3dff6a 100644 --- a/.github/workflows/dockerhub-publish-develop-dagmc.yml +++ b/.github/workflows/dockerhub-publish-develop-dagmc.yml @@ -28,8 +28,9 @@ jobs: push: true tags: openmc/openmc:develop-dagmc build-args: | - include_dagmc=true + build_dagmc=on compile_cores=2 + openmc_branch=develop - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-develop-libmesh.yml b/.github/workflows/dockerhub-publish-develop-libmesh.yml new file mode 100644 index 0000000000..fb83c71791 --- /dev/null +++ b/.github/workflows/dockerhub-publish-develop-libmesh.yml @@ -0,0 +1,36 @@ +name: dockerhub-publish-develop-libmesh + +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: | + build_libmesh=on + compile_cores=2 + openmc_branch=develop + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-libmesh.yml b/.github/workflows/dockerhub-publish-libmesh.yml new file mode 100644 index 0000000000..a861c5c9cd --- /dev/null +++ b/.github/workflows/dockerhub-publish-libmesh.yml @@ -0,0 +1,35 @@ +name: dockerhub-publish-latest-libmesh + +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-libmesh + build-args: | + build_libmesh=on + compile_cores=2 + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/dockerhub-publish-release-dagmc.yml b/.github/workflows/dockerhub-publish-release-dagmc.yml index 6038a9878b..927e91212a 100644 --- a/.github/workflows/dockerhub-publish-release-dagmc.yml +++ b/.github/workflows/dockerhub-publish-release-dagmc.yml @@ -31,7 +31,7 @@ jobs: push: true tags: openmc/openmc:${{ env.RELEASE_VERSION }}-dagmc build-args: | - include_dagmc=true + build_dagmc=on compile_cores=2 - name: Image digest diff --git a/Dockerfile b/Dockerfile index 67ff84a5c2..7399988645 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,149 +1,207 @@ -# To build with OpenMC +# To build with OpenMC and by default this Dockerfile builds the master branch of OpenMC. # docker build -t openmc . +# To build with OpenMC develop branch +# docker build -t openmc_develop --build-arg openmc_branch=develop . + # To build with OpenMC and DAGMC enabled -# docker build -t openmc_dagmc --build-arg include_dagmc=true . +# docker build -t openmc_dagmc --build-arg build_dagmc=on --build-arg compile_cores=4 . -# To make use of multiple cores during the compile stages of the docker build -# docker build -t openmc_dagmc --build-arg compile_cores=8 . +# To build with OpenMC and Libmesh enabled +# docker build -t openmc_libmesh --build-arg build_libmesh=on --build-arg compile_cores=4 . -FROM ubuntu:latest +# To build with both DAGMC and Libmesh enabled +# docker build -t openmc_dagmc_libmesh --build-arg build_dagmc=on --build-arg build_libmesh=on --build-arg compile_cores=4 . -# By default this Dockerfile builds OpenMC without dagmc -ARG include_dagmc=false +# sudo docker run image_name:tag_name or ID with no tag sudo docker run ID number + +FROM debian:bullseye-slim + +# By default this Dockerfile builds OpenMC without DAGMC and LIBMESH support +ARG build_dagmc=off +ARG build_libmesh=off # By default one core is used to compile ARG compile_cores=1 +# Set default value of HOME to /root +ENV HOME=/root + +# OpenMC variables +ARG openmc_branch=master +ENV OPENMC_REPO='https://github.com/openmc-dev/openmc' + +# Embree variables +ENV EMBREE_TAG='v3.12.2' +ENV EMBREE_REPO='https://github.com/embree/embree' +ENV EMBREE_INSTALL_DIR=$HOME/EMBREE/ + +# MOAB variables +ENV MOAB_TAG='5.3.0' +ENV MOAB_REPO='https://bitbucket.org/fathomteam/moab/' + +# Double-Down variables +ENV DD_TAG='v1.0.0' +ENV DD_REPO='https://github.com/pshriwise/double-down' +ENV DD_INSTALL_DIR=$HOME/Double_down + +# DAGMC variables +ENV DAGMC_BRANCH='develop' +ENV DAGMC_REPO='https://github.com/svalinn/DAGMC' +ENV DAGMC_INSTALL_DIR=$HOME/DAGMC/ + +# LIBMESH variables +ENV LIBMESH_TAG='v1.6.0' +ENV LIBMESH_REPO='https://github.com/libMesh/libmesh' +ENV LIBMESH_INSTALL_DIR=$HOME/LIBMESH + # Setup environment variables for Docker image ENV CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ - PATH=/opt/openmc/bin:/opt/NJOY2016/build:$PATH \ - LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ + LD_LIBRARY_PATH=${DAGMC_INSTALL_DIR}/lib:$LD_LIBRARY_PATH \ OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ OPENMC_ENDF_DATA=/root/endf-b-vii.1 \ DEBIAN_FRONTEND=noninteractive -# Install dependencies from Debian package manager +# Install and update dependencies from Debian package manager RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get install -y \ - python3-pip python-is-python3 wget git gfortran g++ cmake \ + python3-pip python-is-python3 wget git build-essential cmake \ mpich libmpich-dev libhdf5-serial-dev libhdf5-mpich-dev \ libpng-dev && \ apt-get autoremove # Update system-provided pip -RUN pip3 install --upgrade pip +RUN pip install --upgrade pip # Clone and install NJOY2016 -RUN git clone https://github.com/njoy/NJOY2016.git /opt/NJOY2016 && \ - cd /opt/NJOY2016 && \ - mkdir build && cd build && \ - cmake -Dstatic=on .. && make 2>/dev/null && make install +RUN cd $HOME && git clone --depth 1 https://github.com/njoy/NJOY2016.git && \ + cd NJOY2016 && mkdir build && cd build && \ + cmake -Dstatic=on .. && make 2>/dev/null -j${compile_cores} install && \ + rm -rf $HOME/NJOY2016 -# 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] ; \ + +RUN if [ "$build_dagmc" = "on" ]; then \ + # Install addition packages required for DAGMC + apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev \ + && pip install --upgrade numpy cython \ + # Clone and install EMBREE + && mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \ + && git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \ + && mkdir build && cd build \ + && cmake ../embree \ + -DCMAKE_INSTALL_PREFIX=${EMBREE_INSTALL_DIR} \ + -DEMBREE_MAX_ISA=NONE \ + -DEMBREE_ISA_SSE42=ON \ + -DEMBREE_ISPC_SUPPORT=OFF \ + && make 2>/dev/null -j${compile_cores} install \ + && rm -rf ${EMBREE_INSTALL_DIR}/build ${EMBREE_INSTALL_DIR}/embree ; \ + # Clone and install MOAB + mkdir -p $HOME/MOAB && cd $HOME/MOAB \ + && git clone --single-branch -b ${MOAB_TAG} --depth 1 ${MOAB_REPO} \ + && mkdir build && cd build \ + && cmake ../moab -DENABLE_HDF5=ON \ + -DENABLE_NETCDF=ON \ + -DBUILD_SHARED_LIBS=OFF \ + -DENABLE_FORTRAN=OFF \ + -DENABLE_BLASLAPACK=OFF \ + && make 2>/dev/null -j${compile_cores} install \ + && cmake ../moab \ + -DENABLE_PYMOAB=ON \ + -DBUILD_SHARED_LIBS=ON \ + && make 2>/dev/null -j${compile_cores} install \ + && cd pymoab && bash install.sh \ + && python setup.py install \ + && rm -rf $HOME/MOAB ; \ + # Clone and install Double-Down + mkdir -p $HOME/Double_down && cd $HOME/Double_down \ + && git clone --single-branch -b ${DD_TAG} --depth 1 ${DD_REPO} \ + && mkdir build && cd build \ + && cmake ../double-down -DCMAKE_INSTALL_PREFIX=${DD_INSTALL_DIR} \ + -DMOAB_DIR=/usr/local \ + -DEMBREE_DIR=${EMBREE_INSTALL_DIR} \ + && make 2>/dev/null -j${compile_cores} install \ + && rm -rf ${DD_INSTALL_DIR}/build ${DD_INSTALL_DIR}/double-down ; \ + # Clone and install DAGMC + mkdir -p $HOME/DAGMC && cd $HOME/DAGMC \ + && git clone --single-branch -b ${DAGMC_BRANCH} --depth 1 ${DAGMC_REPO} \ + && mkdir build && cd build \ + && cmake ../DAGMC -DBUILD_TALLY=ON \ + -DCMAKE_INSTALL_PREFIX=${DAGMC_INSTALL_DIR} \ + -DMOAB_DIR=/usr/local \ + -DDOUBLE_DOWN=ON \ + -DDOUBLE_DOWN_DIR=${DD_INSTALL_DIR} \ + -DCMAKE_PREFIX_PATH=${DD_INSTALL_DIR}/lib \ + -DBUILD_STATIC_LIBS=OFF \ + && make 2>/dev/null -j${compile_cores} install \ + && rm -rf ${DAGMC_INSTALL_DIR}/DAGMC ${DAGMC_INSTALL_DIR}/build ; \ 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 ; \ + +RUN if [ "$build_libmesh" = "on" ]; then \ + # Install addition packages required for LIBMESH + apt-get -y install m4 libnetcdf-dev libpnetcdf-dev \ + # Install LIBMESH + && mkdir -p $HOME/LIBMESH && cd $HOME/LIBMESH \ + && git clone --shallow-submodules --recurse-submodules --single-branch -b ${LIBMESH_TAG} --depth 1 ${LIBMESH_REPO} \ + && mkdir build && cd build \ + && ../libmesh/configure \ + --prefix=${LIBMESH_INSTALL_DIR} CXX=mpicxx CC=mpicc FC=mpifort F77=mpif77 \ + --enable-exodus \ + --enable-mpi \ + --enable-silent-rules \ + --enable-unique-id \ + --disable-eigen \ + --disable-fortran \ + --disable-lapack \ + --disable-examples \ + --disable-warnings \ + --disable-maintainer-mode \ + --disable-metaphysicl \ + --with-methods="opt" \ + --without-gdb-command \ + --with-cxx-std-min=2014 \ + && make 2>/dev/null -j${compile_cores} install \ + && rm -rf ${LIBMESH_INSTALL_DIR}/build ${LIBMESH_INSTALL_DIR}/libmesh ; \ fi -# Clone and install Embree -RUN if [ "$include_dagmc" = "true" ] ; \ - then git clone --single-branch --branch v3.12.2 https://github.com/embree/embree.git ; \ - 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 5.2.1 https://bitbucket.org/fathomteam/moab.git ; \ - 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_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 --single-branch --branch main https://github.com/pshriwise/double-down.git ; \ - cd double-down ; \ - mkdir build ; \ - cd build ; \ - cmake .. -DCMAKE_INSTALL_PREFIX=.. \ - -DMOAB_DIR=/usr/local \ - -DEMBREE_DIR=/embree ; \ - 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 --single-branch --branch 3.2.0 https://github.com/svalinn/DAGMC.git ; \ - 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 +# clone and install openmc +RUN mkdir -p ${HOME}/OpenMC && cd ${HOME}/OpenMC \ + && git clone --shallow-submodules --recurse-submodules -b ${openmc_branch} --depth=1 ${OPENMC_REPO} \ + && mkdir build && cd build ; \ + if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "on" ]; then \ + cmake ../openmc \ + -Doptimize=off \ + -Ddebug=off \ + -DHDF5_PREFER_PARALLEL=on \ + -Ddagmc=on \ + -Dlibmesh=on \ + -DCMAKE_PREFIX_PATH="${DAGMC_INSTALL_DIR};${LIBMESH_INSTALL_DIR}" ; \ + fi ; \ + if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "off" ]; then \ + cmake ../openmc \ + -Doptimize=off \ + -Ddebug=off \ + -DHDF5_PREFER_PARALLEL=on \ + -Ddagmc=ON \ + -DCMAKE_PREFIX_PATH=${DAGMC_INSTALL_DIR} ; \ + fi ; \ + if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "on" ]; then \ + cmake ../openmc \ + -Doptimize=off \ + -Ddebug=off \ + -DHDF5_PREFER_PARALLEL=on \ + -Dlibmesh=on \ + -DCMAKE_PREFIX_PATH=${LIBMESH_INSTALL_DIR} ; \ + fi ; \ + if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "off" ]; then \ + cmake ../openmc \ + -Doptimize=off \ + -Ddebug=off \ + -DHDF5_PREFER_PARALLEL=on ; \ + fi ; \ + make 2>/dev/null -j${compile_cores} install \ + && cd ../openmc && pip install -e .[test,depletion-mpi] # Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN /opt/openmc/tools/ci/download-xs.sh +RUN ${HOME}/OpenMC/openmc/tools/ci/download-xs.sh