From 2e4684ef48432ca0f58aa90299ccbdcab5e1fba4 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 13:05:05 -0400 Subject: [PATCH 01/15] Added initial Dockerfile to new docker directory --- docker/Dockerfile | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..4eacc8b02 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,48 @@ +FROM ubuntu:latest +MAINTAINER Will Boyd + +# Setup environment variables for Docker image +ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ + PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ + LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ + OPENMC_CROSS_SECTIONS=/opt/openmc/data/nndc_hdf5/cross_sections.xml \ + OPENMC_MULTIPOLE_LIBRARY=/opt/openmc/data/WMP_Library \ + OPENMC_ENDF_DATA=/opt/openmc/data/endf-b-vii.1 + +# Install dependencies from Debian package manager +RUN apt-get update -y && \ + apt-get upgrade -y && \ + apt-get install -y wget git emacs && \ + apt-get install -y gfortran g++ cmake && \ + apt-get install -y mpich libmpich-dev && \ + apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ + apt-get autoremove + +# Download Miniconda3 and install Python dependencies +RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm -rf ~/miniconda.sh +RUN pip install --upgrade pip && \ + pip install six numpy scipy pandas h5py matplotlib uncertainties lxml cython jupyter pytest && \ + pip install --no-binary=mpi4py mpi4py + +# Clone and install NJOY2016 +RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ + cd /opt/NJOY2016 && \ + mkdir build && cd build && \ + cmake -Dstatic=on .. && make 2>/dev/null && make install + +# Clone and install OpenMC +RUN git clone https://github.com/wbinventor/openmc.git /opt/openmc && \ + cd /opt/openmc && mkdir -p build && cd build && \ + cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \ + make && make install && \ + cd .. && python setup.py install + +# Download cross sections (NNDC and WMP) and ENDF data needed by test suite +RUN mkdir /opt/openmc/data +RUN wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C /opt/openmc/data -xvJ +RUN wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C /opt/openmc/data -xvJ +RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz && \ + tar -C /opt/openmc/data -xzvf WMP_Library_v1.0.tar.gz && \ + rm WMP_Library_v1.0.tar.gz \ No newline at end of file From b395060793b9aaad6ea0afe44fc2f0306096d287 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 13:43:02 -0400 Subject: [PATCH 02/15] Now install Python API in editable mode to allow openmc.data.reconstruct to be usable by test suite --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4eacc8b02..e3923f4b5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,7 +37,7 @@ RUN git clone https://github.com/wbinventor/openmc.git /opt/openmc && \ cd /opt/openmc && mkdir -p build && cd build && \ cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \ make && make install && \ - cd .. && python setup.py install + cd .. && pip install -e . # Download cross sections (NNDC and WMP) and ENDF data needed by test suite RUN mkdir /opt/openmc/data From 84bfa09c82ec45d607ff8fd1d8fd070b5c45a7e5 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 13:51:16 -0400 Subject: [PATCH 03/15] updated Dockerfile to clone from main openmc-dev GitHub repo --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e3923f4b5..5f29f8c2f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,7 +33,7 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ cmake -Dstatic=on .. && make 2>/dev/null && make install # Clone and install OpenMC -RUN git clone https://github.com/wbinventor/openmc.git /opt/openmc && \ +RUN git clone 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 && \ From b69077174d311637fda59cd1de52e336311dd2ff Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 14:00:16 -0400 Subject: [PATCH 04/15] Moved Dockerfile to root context --- Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5f29f8c2f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM ubuntu:latest +MAINTAINER Will Boyd + +# Setup environment variables for Docker image +ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ + PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ + LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ + OPENMC_CROSS_SECTIONS=/opt/openmc/data/nndc_hdf5/cross_sections.xml \ + OPENMC_MULTIPOLE_LIBRARY=/opt/openmc/data/WMP_Library \ + OPENMC_ENDF_DATA=/opt/openmc/data/endf-b-vii.1 + +# Install dependencies from Debian package manager +RUN apt-get update -y && \ + apt-get upgrade -y && \ + apt-get install -y wget git emacs && \ + apt-get install -y gfortran g++ cmake && \ + apt-get install -y mpich libmpich-dev && \ + apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ + apt-get autoremove + +# Download Miniconda3 and install Python dependencies +RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm -rf ~/miniconda.sh +RUN pip install --upgrade pip && \ + pip install six numpy scipy pandas h5py matplotlib uncertainties lxml cython jupyter pytest && \ + pip install --no-binary=mpi4py mpi4py + +# Clone and install NJOY2016 +RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ + cd /opt/NJOY2016 && \ + mkdir build && cd build && \ + cmake -Dstatic=on .. && make 2>/dev/null && make install + +# Clone and install OpenMC +RUN git clone 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 . + +# Download cross sections (NNDC and WMP) and ENDF data needed by test suite +RUN mkdir /opt/openmc/data +RUN wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C /opt/openmc/data -xvJ +RUN wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C /opt/openmc/data -xvJ +RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz && \ + tar -C /opt/openmc/data -xzvf WMP_Library_v1.0.tar.gz && \ + rm WMP_Library_v1.0.tar.gz \ No newline at end of file From e851a568618e265829b36d0f166978f113ec9394 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 16:21:18 -0400 Subject: [PATCH 05/15] Updated documentation with Docker installation instructions --- docs/source/quickinstall.rst | 43 ++++++++++++++++++++++ docs/source/usersguide/install.rst | 57 ++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 731bffde7..f172accb3 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -58,6 +58,49 @@ are no longer supported. .. _Personal Package Archive: https://launchpad.net/~paulromano/+archive/staging .. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto +------------------------------------------- +Installing with Docker on Linux/Mac/Windows +------------------------------------------- + +OpenMC can be easily deployed using `Docker `_ on any +Windows, Mac or Linux system. With Docker running, execute the following +command in the shell to build a `Docker image`_ called ``debian/openmc:latest``: + +.. code-block:: sh + + docker build -t debian/openmc:latest https://github.com/openmc-dev/openmc.git#develop + +.. note:: This may take 5 -- 10 minutes to run to completion. + +This command will execute the instructions in OpenMC's ``Dockerfile`` to +build a Docker image with OpenMC installed to ``/opt/openmc``. After building +the Docker image, you can run the following to see the names of all images +on your machine, including ``debian/openmc:latest``: + +.. code-block:: sh + + docker image ls + +Now you can run the following to create a `Docker container`_ called +``my_openmc`` based on the ``debian/openmc:latest`` image: + +.. code-block:: sh + + docker run -it --name=my_openmc debian/openmc:latest + +This command will open an interactive shell running from within the +Docker container where you have access to use OpenMC. + +.. note:: The ``docker run`` command supports many + `options `_ + for spawning containers -- including `mounting volumes`_ from the + host filesystem -- which many users will find useful. + +.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/ +.. _Docker container: https://www.docker.com/resources/what-container +.. _options: https://docs.docker.com/engine/reference/commandline/run/ +.. _mounting volumes: https://docs.docker.com/storage/volumes/ + --------------------------------------- Installing from Source on Ubuntu 15.04+ --------------------------------------- diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 48dcd8c78..17810d23c 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -71,6 +71,63 @@ are no longer supported. .. _Personal Package Archive: https://launchpad.net/~paulromano/+archive/staging .. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto +.. _install_docker: + +------------------------------------------- +Installing with Docker on Linux/Mac/Windows +------------------------------------------- + +OpenMC can be easily deployed using `Docker `_ on any +Windows, Mac or Linux system. With Docker running, execute the following +command in the shell to build a `Docker image`_ called ``debian/openmc:latest``: + +.. code-block:: sh + + docker build -t debian/openmc:latest https://github.com/openmc-dev/openmc.git#develop + +.. note:: This may take 5 -- 10 minutes to run to completion. + +This command will execute the instructions in OpenMC's ``Dockerfile`` to +build a Docker image with OpenMC installed. The image includes OpenMC with +MPICH and parallel HDF5 in the ``/opt/openmc`` directory, and +`Miniconda3 `_ with all of the Python +pre-requisites (NumPy, SciPy, Pandas, etc.) installed. The +`NJOY2016 `_ codebase is installed in +``/opt/NJOY2016`` to support full functionality and testing of the +``openmc.data`` Python module. The publicly available nuclear data libraries +necessary to run OpenMC's test suite -- including NNDC and WMP cross sections +and ENDF data -- are in the ``/opt/openmc/data directory``, and the +corresponding :envvar:`OPENMC_CROSS_SECTIONS`, +:envvar:`OPENMC_MULTIPOLE_LIBRARY`, and :envvar:`OPENMC_ENDF_DATA` +environment variables are initialized. + +After building the Docker image, you can run the following to see the names of +all images on your machine, including ``debian/openmc:latest``: + +.. code-block:: sh + + docker image ls + +Now you can run the following to create a `Docker container`_ called +``my_openmc`` based on the ``debian/openmc:latest`` image: + +.. code-block:: sh + + docker run -it --name=my_openmc debian/openmc:latest + +This command will open an interactive shell running from within the +Docker container where you have access to use OpenMC. + +.. note:: The ``docker run`` command supports many + `options `_ + for spawning containers -- including `mounting volumes`_ from the + host filesystem -- which many users will find useful. + +.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/ +.. _Docker container: https://www.docker.com/resources/what-container +.. _options: https://docs.docker.com/engine/reference/commandline/run/ +.. _mounting volumes: https://docs.docker.com/storage/volumes/ + .. _install_source: ---------------------- From dfcdddeb691775006cfdf54cbc59dfb3ee8f2503 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 23 Sep 2018 16:24:13 -0400 Subject: [PATCH 06/15] Removed docker folder and removed maintainer status from Dockerfile --- Dockerfile | 1 - docker/Dockerfile | 48 ----------------------------------------------- 2 files changed, 49 deletions(-) delete mode 100644 docker/Dockerfile diff --git a/Dockerfile b/Dockerfile index 5f29f8c2f..d452f70b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM ubuntu:latest -MAINTAINER Will Boyd # Setup environment variables for Docker image ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 5f29f8c2f..000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM ubuntu:latest -MAINTAINER Will Boyd - -# Setup environment variables for Docker image -ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ - PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ - LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ - OPENMC_CROSS_SECTIONS=/opt/openmc/data/nndc_hdf5/cross_sections.xml \ - OPENMC_MULTIPOLE_LIBRARY=/opt/openmc/data/WMP_Library \ - OPENMC_ENDF_DATA=/opt/openmc/data/endf-b-vii.1 - -# Install dependencies from Debian package manager -RUN apt-get update -y && \ - apt-get upgrade -y && \ - apt-get install -y wget git emacs && \ - apt-get install -y gfortran g++ cmake && \ - apt-get install -y mpich libmpich-dev && \ - apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ - apt-get autoremove - -# Download Miniconda3 and install Python dependencies -RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ - /bin/bash ~/miniconda.sh -b -p /opt/conda && \ - rm -rf ~/miniconda.sh -RUN pip install --upgrade pip && \ - pip install six numpy scipy pandas h5py matplotlib uncertainties lxml cython jupyter pytest && \ - pip install --no-binary=mpi4py mpi4py - -# Clone and install NJOY2016 -RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ - cd /opt/NJOY2016 && \ - mkdir build && cd build && \ - cmake -Dstatic=on .. && make 2>/dev/null && make install - -# Clone and install OpenMC -RUN git clone 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 . - -# Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN mkdir /opt/openmc/data -RUN wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C /opt/openmc/data -xvJ -RUN wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C /opt/openmc/data -xvJ -RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz && \ - tar -C /opt/openmc/data -xzvf WMP_Library_v1.0.tar.gz && \ - rm WMP_Library_v1.0.tar.gz \ No newline at end of file From aabdb9aabc0e0f32b616bca38eb0735c4ce02507 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 26 Sep 2018 23:24:45 -0400 Subject: [PATCH 07/15] Added docker download script --- docker/docker-download-xs.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 docker/docker-download-xs.sh diff --git a/docker/docker-download-xs.sh b/docker/docker-download-xs.sh new file mode 100755 index 000000000..5ac270090 --- /dev/null +++ b/docker/docker-download-xs.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +# Download NNDC HDF5 data +if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then + wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C $HOME -xvJ +fi + +# Download ENDF/B-VII.1 distribution +ENDF=$HOME/endf-b-vii.1/ +if [[ ! -d $ENDF/neutrons || ! -d $ENDF/photoat || ! -d $ENDF/atomic_relax ]]; then + wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C $HOME -xvJ +fi + +# Download multipole library +if [[ ! -e $HOME/WMP_Library/092235.h5 ]]; then + wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz + tar -C $HOME -xzvf WMP_Library_v1.0.tar.gz +fi From cc3e85db99ecf9de47a3427ae6a2a873013d6ca3 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 26 Sep 2018 23:40:11 -0400 Subject: [PATCH 08/15] Updated Dockerfile to call new docker-download-xs.sh script --- Dockerfile | 20 +++++++------------- docker/Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 docker/Dockerfile diff --git a/Dockerfile b/Dockerfile index d452f70b9..b40548420 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,9 @@ FROM ubuntu:latest ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ - OPENMC_CROSS_SECTIONS=/opt/openmc/data/nndc_hdf5/cross_sections.xml \ - OPENMC_MULTIPOLE_LIBRARY=/opt/openmc/data/WMP_Library \ - OPENMC_ENDF_DATA=/opt/openmc/data/endf-b-vii.1 + OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ + OPENMC_MULTIPOLE_LIBRARY=/root/WMP_Library \ + OPENMC_ENDF_DATA=/root/endf-b-vii.1 # Install dependencies from Debian package manager RUN apt-get update -y && \ @@ -15,15 +15,14 @@ RUN apt-get update -y && \ apt-get install -y gfortran g++ cmake && \ apt-get install -y mpich libmpich-dev && \ apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ + apt-get install -y imagemagick && \ apt-get autoremove # Download Miniconda3 and install Python dependencies RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ /bin/bash ~/miniconda.sh -b -p /opt/conda && \ rm -rf ~/miniconda.sh -RUN pip install --upgrade pip && \ - pip install six numpy scipy pandas h5py matplotlib uncertainties lxml cython jupyter pytest && \ - pip install --no-binary=mpi4py mpi4py +RUN pip install --upgrade pip # Clone and install NJOY2016 RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ @@ -36,12 +35,7 @@ RUN git clone 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 . + cd .. && pip install -e .[test] # Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN mkdir /opt/openmc/data -RUN wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C /opt/openmc/data -xvJ -RUN wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C /opt/openmc/data -xvJ -RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz && \ - tar -C /opt/openmc/data -xzvf WMP_Library_v1.0.tar.gz && \ - rm WMP_Library_v1.0.tar.gz \ No newline at end of file +RUN ./opt/openmc/docker/docker-download-xs.sh \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..b40548420 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,41 @@ +FROM ubuntu:latest + +# Setup environment variables for Docker image +ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ + PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ + LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ + OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ + OPENMC_MULTIPOLE_LIBRARY=/root/WMP_Library \ + OPENMC_ENDF_DATA=/root/endf-b-vii.1 + +# Install dependencies from Debian package manager +RUN apt-get update -y && \ + apt-get upgrade -y && \ + apt-get install -y wget git emacs && \ + apt-get install -y gfortran g++ cmake && \ + apt-get install -y mpich libmpich-dev && \ + apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ + apt-get install -y imagemagick && \ + apt-get autoremove + +# Download Miniconda3 and install Python dependencies +RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm -rf ~/miniconda.sh +RUN pip install --upgrade pip + +# Clone and install NJOY2016 +RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ + cd /opt/NJOY2016 && \ + mkdir build && cd build && \ + cmake -Dstatic=on .. && make 2>/dev/null && make install + +# Clone and install OpenMC +RUN git clone 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] + +# Download cross sections (NNDC and WMP) and ENDF data needed by test suite +RUN ./opt/openmc/docker/docker-download-xs.sh \ No newline at end of file From 87043f9a647e0dd2824375379175e11a27fdb185 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 27 Sep 2018 19:09:54 -0400 Subject: [PATCH 09/15] Conslidated Travis and Docker XS download scripts --- Dockerfile | 18 ++++---- docker/Dockerfile | 41 ------------------- .../ci/download-xs.sh | 0 tools/ci/travis-before-script.sh | 18 +------- 4 files changed, 12 insertions(+), 65 deletions(-) delete mode 100644 docker/Dockerfile rename docker/docker-download-xs.sh => tools/ci/download-xs.sh (100%) diff --git a/Dockerfile b/Dockerfile index b40548420..e2365e530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ # Install dependencies from Debian package manager RUN apt-get update -y && \ apt-get upgrade -y && \ + apt-get install -y python3-pip && \ apt-get install -y wget git emacs && \ apt-get install -y gfortran g++ cmake && \ apt-get install -y mpich libmpich-dev && \ @@ -19,10 +20,10 @@ RUN apt-get update -y && \ apt-get autoremove # Download Miniconda3 and install Python dependencies -RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ - /bin/bash ~/miniconda.sh -b -p /opt/conda && \ - rm -rf ~/miniconda.sh -RUN pip install --upgrade pip +#RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ +# /bin/bash ~/miniconda.sh -b -p /opt/conda && \ +# rm -rf ~/miniconda.sh +#RUN pip install --upgrade pip # Clone and install NJOY2016 RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ @@ -31,11 +32,12 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ cmake -Dstatic=on .. && make 2>/dev/null && make install # Clone and install OpenMC -RUN git clone https://github.com/openmc-dev/openmc.git /opt/openmc && \ - cd /opt/openmc && mkdir -p build && cd build && \ +RUN git clone https://github.com/wbinventor/openmc.git /opt/openmc && \ + cd /opt/openmc && git checkout docker && mkdir -p build && cd build && \ cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \ make && make install && \ - cd .. && pip install -e .[test] + cd .. && pip3 install -e .[test] # Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN ./opt/openmc/docker/docker-download-xs.sh \ No newline at end of file +#RUN ./opt/openmc/docker/docker-download-xs.sh +RUN ./opt/openmc/tools/ci/download-xs.sh \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index b40548420..000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -FROM ubuntu:latest - -# Setup environment variables for Docker image -ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ - PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ - LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ - OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ - OPENMC_MULTIPOLE_LIBRARY=/root/WMP_Library \ - OPENMC_ENDF_DATA=/root/endf-b-vii.1 - -# Install dependencies from Debian package manager -RUN apt-get update -y && \ - apt-get upgrade -y && \ - apt-get install -y wget git emacs && \ - apt-get install -y gfortran g++ cmake && \ - apt-get install -y mpich libmpich-dev && \ - apt-get install -y libhdf5-serial-dev libhdf5-mpich-dev && \ - apt-get install -y imagemagick && \ - apt-get autoremove - -# Download Miniconda3 and install Python dependencies -RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ - /bin/bash ~/miniconda.sh -b -p /opt/conda && \ - rm -rf ~/miniconda.sh -RUN pip install --upgrade pip - -# Clone and install NJOY2016 -RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ - cd /opt/NJOY2016 && \ - mkdir build && cd build && \ - cmake -Dstatic=on .. && make 2>/dev/null && make install - -# Clone and install OpenMC -RUN git clone 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] - -# Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN ./opt/openmc/docker/docker-download-xs.sh \ No newline at end of file diff --git a/docker/docker-download-xs.sh b/tools/ci/download-xs.sh similarity index 100% rename from docker/docker-download-xs.sh rename to tools/ci/download-xs.sh diff --git a/tools/ci/travis-before-script.sh b/tools/ci/travis-before-script.sh index f267cb020..d5ee1331a 100755 --- a/tools/ci/travis-before-script.sh +++ b/tools/ci/travis-before-script.sh @@ -5,19 +5,5 @@ set -ex # https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI sh -e /etc/init.d/xvfb start -# Download NNDC HDF5 data -if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then - wget https://anl.box.com/shared/static/a0eflty17atnpd0pp7460exagr3nuhm7.xz -O - | tar -C $HOME -xvJ -fi - -# Download ENDF/B-VII.1 distribution -ENDF=$HOME/endf-b-vii.1/ -if [[ ! -d $ENDF/neutrons || ! -d $ENDF/photoat || ! -d $ENDF/atomic_relax ]]; then - wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C $HOME -xvJ -fi - -# Download multipole library -if [[ ! -e $HOME/WMP_Library/092235.h5 ]]; then - wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.0/WMP_Library_v1.0.tar.gz - tar -C $HOME -xzvf WMP_Library_v1.0.tar.gz -fi +# Download NNDC HDF5 data, ENDF/B-VII.1 distribution, multipole library +sh /download-xs.sh From 05081709910da582f3bbb1703875698edf81ecfa Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 27 Sep 2018 19:12:37 -0400 Subject: [PATCH 10/15] Added pip3 installation of NumPy to Dockerfile which is necessary to use system pip3 to install all OpenMC Python prerequisites --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index e2365e530..fb5149efd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get update -y && \ apt-get autoremove # Download Miniconda3 and install Python dependencies +RUN pip3 install numpy #RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ # /bin/bash ~/miniconda.sh -b -p /opt/conda && \ # rm -rf ~/miniconda.sh From b120e05b18141e23bab99dd0971784006f2634a1 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 27 Sep 2018 20:41:25 -0400 Subject: [PATCH 11/15] Removed commented lines in Dockerfile --- Dockerfile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index fb5149efd..c29e1321c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:latest # Setup environment variables for Docker image ENV FC=/usr/bin/mpif90 CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ - PATH=/opt/openmc/bin:/opt/conda/bin:/opt/NJOY2016/build:$PATH \ + PATH=/opt/openmc/bin:/opt/NJOY2016/build:$PATH \ LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ OPENMC_MULTIPOLE_LIBRARY=/root/WMP_Library \ @@ -19,12 +19,8 @@ RUN apt-get update -y && \ apt-get install -y imagemagick && \ apt-get autoremove -# Download Miniconda3 and install Python dependencies -RUN pip3 install numpy -#RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ -# /bin/bash ~/miniconda.sh -b -p /opt/conda && \ -# rm -rf ~/miniconda.sh -#RUN pip install --upgrade pip +# Update system-provided pip +RUN pip3 install --upgrade pip # Clone and install NJOY2016 RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ @@ -33,12 +29,11 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \ cmake -Dstatic=on .. && make 2>/dev/null && make install # Clone and install OpenMC -RUN git clone https://github.com/wbinventor/openmc.git /opt/openmc && \ - cd /opt/openmc && git checkout docker && mkdir -p build && cd build && \ +RUN git clone 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 .. && pip3 install -e .[test] + cd .. && pip install -e .[test] # Download cross sections (NNDC and WMP) and ENDF data needed by test suite -#RUN ./opt/openmc/docker/docker-download-xs.sh RUN ./opt/openmc/tools/ci/download-xs.sh \ No newline at end of file From f2e773780db2ae9fb508471818921b44e81a697d Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 27 Sep 2018 20:42:51 -0400 Subject: [PATCH 12/15] Updated relative paths in call to download-xs.sh for travis --- tools/ci/travis-before-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/travis-before-script.sh b/tools/ci/travis-before-script.sh index d5ee1331a..c810a4a4d 100755 --- a/tools/ci/travis-before-script.sh +++ b/tools/ci/travis-before-script.sh @@ -6,4 +6,4 @@ set -ex sh -e /etc/init.d/xvfb start # Download NNDC HDF5 data, ENDF/B-VII.1 distribution, multipole library -sh /download-xs.sh +sh ./tools/ci/download-xs.sh From b9eb6455ad0c2bdea7e78e5b79b6b1b7aea64af9 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 30 Sep 2018 16:51:57 -0400 Subject: [PATCH 13/15] Moved detailed Docker deployment discussion to dev guide; quick install now directs users to pull an run from DockerHub --- docs/source/devguide/docker.rst | 57 ++++++++++++++++++++++++++++++ docs/source/devguide/index.rst | 1 + docs/source/quickinstall.rst | 27 +++----------- docs/source/usersguide/install.rst | 57 ------------------------------ 4 files changed, 62 insertions(+), 80 deletions(-) create mode 100644 docs/source/devguide/docker.rst diff --git a/docs/source/devguide/docker.rst b/docs/source/devguide/docker.rst new file mode 100644 index 000000000..12c095c45 --- /dev/null +++ b/docs/source/devguide/docker.rst @@ -0,0 +1,57 @@ +.. _devguide_docker: + +====================== +Deployment with Docker +====================== + +OpenMC can be easily deployed using `Docker `_ on any +Windows, Mac or Linux system. With Docker running, execute the following +command in the shell to build a `Docker image`_ called ``debian/openmc:latest``: + +.. code-block:: sh + + docker build -t debian/openmc:latest https://github.com/openmc-dev/openmc.git#develop + +.. note:: This may take 5 -- 10 minutes to run to completion. + +This command will execute the instructions in OpenMC's ``Dockerfile`` to +build a Docker image with OpenMC installed. The image includes OpenMC with +MPICH and parallel HDF5 in the ``/opt/openmc`` directory, and +`Miniconda3 `_ with all of the Python +pre-requisites (NumPy, SciPy, Pandas, etc.) installed. The +`NJOY2016 `_ codebase is installed in +``/opt/NJOY2016`` to support full functionality and testing of the +``openmc.data`` Python module. The publicly available nuclear data libraries +necessary to run OpenMC's test suite -- including NNDC and WMP cross sections +and ENDF data -- are in the ``/opt/openmc/data directory``, and the +corresponding :envvar:`OPENMC_CROSS_SECTIONS`, +:envvar:`OPENMC_MULTIPOLE_LIBRARY`, and :envvar:`OPENMC_ENDF_DATA` +environment variables are initialized. + +After building the Docker image, you can run the following to see the names of +all images on your machine, including ``debian/openmc:latest``: + +.. code-block:: sh + + docker image ls + +Now you can run the following to create a `Docker container`_ called +``my_openmc`` based on the ``debian/openmc:latest`` image: + +.. code-block:: sh + + docker run -it --name=my_openmc debian/openmc:latest + +This command will open an interactive shell running from within the +Docker container where you have access to use OpenMC. + +.. note:: The ``docker run`` command supports many + `options `_ + for spawning containers -- including `mounting volumes`_ from the + host filesystem -- which many users will find useful. + +.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/ +.. _Docker container: https://www.docker.com/resources/what-container +.. _options: https://docs.docker.com/engine/reference/commandline/run/ +.. _mounting volumes: https://docs.docker.com/storage/volumes/ + diff --git a/docs/source/devguide/index.rst b/docs/source/devguide/index.rst index e2410f080..d100fdcdf 100644 --- a/docs/source/devguide/index.rst +++ b/docs/source/devguide/index.rst @@ -18,3 +18,4 @@ other related topics. tests user-input docbuild + docker diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index f172accb3..33f99e0a9 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -59,37 +59,18 @@ are no longer supported. .. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto ------------------------------------------- -Installing with Docker on Linux/Mac/Windows +Installing on Linux/Mac/Windows with Docker ------------------------------------------- OpenMC can be easily deployed using `Docker `_ on any Windows, Mac or Linux system. With Docker running, execute the following -command in the shell to build a `Docker image`_ called ``debian/openmc:latest``: +command in the shell to download and run a `Docker image`_ with the most recent release of OpenMC from `DockerHub `_ called ``openmc/openmc:latest``: .. code-block:: sh - docker build -t debian/openmc:latest https://github.com/openmc-dev/openmc.git#develop + docker run openmc/openmc:latest -.. note:: This may take 5 -- 10 minutes to run to completion. - -This command will execute the instructions in OpenMC's ``Dockerfile`` to -build a Docker image with OpenMC installed to ``/opt/openmc``. After building -the Docker image, you can run the following to see the names of all images -on your machine, including ``debian/openmc:latest``: - -.. code-block:: sh - - docker image ls - -Now you can run the following to create a `Docker container`_ called -``my_openmc`` based on the ``debian/openmc:latest`` image: - -.. code-block:: sh - - docker run -it --name=my_openmc debian/openmc:latest - -This command will open an interactive shell running from within the -Docker container where you have access to use OpenMC. +This will take 5 -- 10 minutes to run to completion depending on your internet download speed. The command will place you in an interactive shell running in a `Docker container`_ with OpenMC installed. .. note:: The ``docker run`` command supports many `options `_ diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 17810d23c..48dcd8c78 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -71,63 +71,6 @@ are no longer supported. .. _Personal Package Archive: https://launchpad.net/~paulromano/+archive/staging .. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto -.. _install_docker: - -------------------------------------------- -Installing with Docker on Linux/Mac/Windows -------------------------------------------- - -OpenMC can be easily deployed using `Docker `_ on any -Windows, Mac or Linux system. With Docker running, execute the following -command in the shell to build a `Docker image`_ called ``debian/openmc:latest``: - -.. code-block:: sh - - docker build -t debian/openmc:latest https://github.com/openmc-dev/openmc.git#develop - -.. note:: This may take 5 -- 10 minutes to run to completion. - -This command will execute the instructions in OpenMC's ``Dockerfile`` to -build a Docker image with OpenMC installed. The image includes OpenMC with -MPICH and parallel HDF5 in the ``/opt/openmc`` directory, and -`Miniconda3 `_ with all of the Python -pre-requisites (NumPy, SciPy, Pandas, etc.) installed. The -`NJOY2016 `_ codebase is installed in -``/opt/NJOY2016`` to support full functionality and testing of the -``openmc.data`` Python module. The publicly available nuclear data libraries -necessary to run OpenMC's test suite -- including NNDC and WMP cross sections -and ENDF data -- are in the ``/opt/openmc/data directory``, and the -corresponding :envvar:`OPENMC_CROSS_SECTIONS`, -:envvar:`OPENMC_MULTIPOLE_LIBRARY`, and :envvar:`OPENMC_ENDF_DATA` -environment variables are initialized. - -After building the Docker image, you can run the following to see the names of -all images on your machine, including ``debian/openmc:latest``: - -.. code-block:: sh - - docker image ls - -Now you can run the following to create a `Docker container`_ called -``my_openmc`` based on the ``debian/openmc:latest`` image: - -.. code-block:: sh - - docker run -it --name=my_openmc debian/openmc:latest - -This command will open an interactive shell running from within the -Docker container where you have access to use OpenMC. - -.. note:: The ``docker run`` command supports many - `options `_ - for spawning containers -- including `mounting volumes`_ from the - host filesystem -- which many users will find useful. - -.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/ -.. _Docker container: https://www.docker.com/resources/what-container -.. _options: https://docs.docker.com/engine/reference/commandline/run/ -.. _mounting volumes: https://docs.docker.com/storage/volumes/ - .. _install_source: ---------------------- From 3516980b0d09df5851c70de8a86b5ea8d54db908 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 30 Sep 2018 18:11:31 -0400 Subject: [PATCH 14/15] Fixed hyperlink to Docker runtime options in quick install instructions --- docs/source/quickinstall.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 33f99e0a9..11cb5e1b7 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -70,12 +70,11 @@ command in the shell to download and run a `Docker image`_ with the most recent docker run openmc/openmc:latest -This will take 5 -- 10 minutes to run to completion depending on your internet download speed. The command will place you in an interactive shell running in a `Docker container`_ with OpenMC installed. +This will take several minutes to run depending on your internet download speed. The command will place you in an interactive shell running in a `Docker container`_ with OpenMC installed. -.. note:: The ``docker run`` command supports many - `options `_ - for spawning containers -- including `mounting volumes`_ from the - host filesystem -- which many users will find useful. +.. note:: The ``docker run`` command supports many `options`_ for spawning + containers -- including `mounting volumes`_ from the host + filesystem -- which many users will find useful. .. _Docker image: https://docs.docker.com/engine/reference/commandline/images/ .. _Docker container: https://www.docker.com/resources/what-container From 5c7a29a0e39c942eea61b90fde0fe2bf617918a5 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 2 Oct 2018 18:25:31 -0400 Subject: [PATCH 15/15] Updated quick install instructions with v0.10.0 Docker image tag --- docs/source/quickinstall.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 11cb5e1b7..37e431f55 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -64,11 +64,11 @@ Installing on Linux/Mac/Windows with Docker OpenMC can be easily deployed using `Docker `_ on any Windows, Mac or Linux system. With Docker running, execute the following -command in the shell to download and run a `Docker image`_ with the most recent release of OpenMC from `DockerHub `_ called ``openmc/openmc:latest``: +command in the shell to download and run a `Docker image`_ with the most recent release of OpenMC from `DockerHub `_ called ``openmc/openmc:v0.10.0``: .. code-block:: sh - docker run openmc/openmc:latest + docker run openmc/openmc:v0.10.0 This will take several minutes to run depending on your internet download speed. The command will place you in an interactive shell running in a `Docker container`_ with OpenMC installed.