-
Notifications
You must be signed in to change notification settings - Fork 12
[PullRequest.com] Project review #639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: removed_code_for_pullrequest
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Jonathan Shimwell | ||
| John Billingsley | ||
| Remi Delaporte-Mathurin | ||
| Declan Morbey | ||
| Matthew Bluteau | ||
| Patrick Shriwise |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| # This dockerfile can be built in a few different ways. | ||
| # Docker build commands must be run from within the base repository directory | ||
| # | ||
| # There are build args availalbe for specifying the: | ||
| # - cq_version | ||
| # The version of CadQuery to use master or 2. | ||
| # Default is 2. | ||
| # Options: [master, 2] | ||
| # | ||
| # - include_neutronics | ||
| # If software dependencies needed for neutronics simulations should be | ||
| # included true or false. | ||
| # Default is false. | ||
| # Options: [true, false] | ||
| # | ||
| # - compile_cores | ||
| # The number of CPU cores to compile the image with. | ||
| # Default is 1. | ||
| # Options: [1, 2, 3, 4, 5, 6...] | ||
| # | ||
| # Example builds: | ||
| # Building using the defaults (cq_version 2, no neutronics and 1 core compile) | ||
| # docker build -t ukaea/paramak . | ||
| # | ||
| # Building to include cadquery master, neutronics dependencies and use 8 cores. | ||
| # Run command from within the base repository directory | ||
| # docker build -t ukaea/paramak --build-arg include_neutronics=true --build-arg compile_cores=8 --build-arg cq_version=master . | ||
|
|
||
| # Once build the dockerimage can be run in a few different ways. | ||
| # | ||
| # Run with the following command for a terminal notebook interface | ||
| # docker run -it ukaea/paramak . | ||
| # | ||
| # Run with the following command for a jupyter notebook interface | ||
| # docker run -p 8888:8888 ukaea/paramak /bin/bash -c "jupyter notebook --notebook-dir=/examples --ip='*' --port=8888 --no-browser --allow-root" | ||
shimwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| # Once built, the docker image can be tested with either of the following commands | ||
| # docker run --rm ukaea/paramak pytest /tests | ||
| # docker run --rm ukaea/paramak /bin/bash -c "cd .. && bash run_tests.sh" | ||
|
|
||
shimwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| FROM continuumio/miniconda3 | ||
|
|
||
| # By default this Dockerfile builds with the latest release of CadQuery 2 | ||
| ARG cq_version=2 | ||
| ARG include_neutronics=false | ||
| ARG compile_cores=1 | ||
|
|
||
| ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \ | ||
| PATH=/opt/openmc/bin:/opt/NJOY2016/build:$PATH \ | ||
| LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ | ||
| CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ | ||
| DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get upgrade -y | ||
|
|
||
| RUN apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev \ | ||
| freeglut3-dev libosmesa6 libosmesa6-dev \ | ||
| libgles2-mesa-dev && \ | ||
| apt-get clean | ||
|
|
||
| # Installing CadQuery | ||
| # jupyter is installed before cadquery to avoid a conflict | ||
| RUN echo installing CadQuery version $cq_version && \ | ||
| conda install jupyter -y --quiet && \ | ||
| conda install -c cadquery -c conda-forge cadquery="$cq_version" && \ | ||
| conda clean -afy | ||
|
|
||
| # Install neutronics dependencies from Debian package manager | ||
| RUN if [ "$include_neutronics" = "true" ] ; \ | ||
| then echo installing with include_neutronics=true ; \ | ||
| apt-get install -y \ | ||
| wget git gfortran g++ cmake \ | ||
| mpich libmpich-dev libhdf5-serial-dev libhdf5-mpich-dev \ | ||
| imagemagick ; \ | ||
| fi | ||
|
|
||
| # install addition packages required for MOAB | ||
| RUN if [ "$include_neutronics" = "true" ] ; \ | ||
| then echo installing with include_neutronics=true ; \ | ||
| apt-get --yes install libeigen3-dev ; \ | ||
| apt-get --yes install libblas-dev ; \ | ||
| apt-get --yes install liblapack-dev ; \ | ||
| apt-get --yes install libnetcdf-dev ; \ | ||
| apt-get --yes install libtbb-dev ; \ | ||
| apt-get --yes install libglfw3-dev ; \ | ||
| fi | ||
|
|
||
| # Clone and install NJOY2016 | ||
| RUN if [ "$include_neutronics" = "true" ] ; \ | ||
| then 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 ; \ | ||
| fi | ||
|
|
||
| # Clone and install Embree | ||
| RUN if [ "$include_neutronics" = "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_neutronics" = "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 \ | ||
| -DCMAKE_INSTALL_PREFIX=/MOAB ; \ | ||
| 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 \ | ||
| -DCMAKE_INSTALL_PREFIX=/MOAB ; \ | ||
| make -j"$compile_cores" ; \ | ||
| make -j"$compile_cores" install ; \ | ||
| cd pymoab ; \ | ||
| bash install.sh ; \ | ||
| python setup.py install ; \ | ||
| fi | ||
|
|
||
|
|
||
| # Clone and install Double-Down | ||
| RUN if [ "$include_neutronics" = "true" ] ; \ | ||
| then git clone https://github.com/pshriwise/double-down ; \ | ||
| cd double-down ; \ | ||
| mkdir build ; \ | ||
| cd build ; \ | ||
| cmake .. -DCMAKE_INSTALL_PREFIX=.. \ | ||
| -DMOAB_DIR=/MOAB \ | ||
| -DEMBREE_DIR=/embree/lib/cmake/embree-3.12.1 \ | ||
| -DEMBREE_ROOT=/embree/lib/cmake/embree-3.12.1 ; \ | ||
| make -j"$compile_cores" ; \ | ||
| make -j"$compile_cores" install ; \ | ||
| fi | ||
|
|
||
| # Clone and install DAGMC | ||
| RUN if [ "$include_neutronics" = "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=/MOAB \ | ||
| -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_neutronics" = "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] ; \ | ||
| /opt/openmc/tools/ci/download-xs.sh ; \ | ||
| fi | ||
|
|
||
| ENV OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml | ||
|
|
||
| # Copies over the Paramak code from the local repository | ||
|
|
||
| RUN if [ "$include_neutronics" = "true" ] ; \ | ||
| then pip install neutronics_material_maker ; \ | ||
| pip install parametric_plasma_source ; \ | ||
| fi | ||
|
|
||
| COPY requirements.txt requirements.txt | ||
| RUN pip install -r requirements.txt | ||
|
|
||
|
|
||
| # Copy over the source code, examples and tests | ||
| COPY run_tests.sh run_tests.sh | ||
| COPY paramak paramak/ | ||
| COPY examples examples/ | ||
| COPY setup.py setup.py | ||
| COPY tests tests/ | ||
| COPY README.md README.md | ||
|
|
||
| # using setup.py instead of pip due to https://github.com/pypa/pip/issues/5816 | ||
| RUN python setup.py install | ||
|
|
||
| WORKDIR examples | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MAINTAINABILITY It would appear that one of the projects that paramak depends on (openmc) isn't installed in the Dockerfile or it's not available in the default environment. When we were able to run the tests after fixing the issue above , we came across a string of warnings: There were more than those listed above, shortening for brevity. It's best practice to ensure minimal warnings when running tests. In this case, there seem to be 228 warnings.
shimwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2020 UKAEA | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| include README.md | ||
| include requirements.txt | ||
| include LICENSE.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUG RISK
Currently, the project is installed in
/. This is fine, but it clutters the root directory of the docker image and makes it so that the user cannot simply volume mount their current directory to test its changes via:If the user tries to volume mount inside of
/, then they'll replace the entire filesystem.