diff --git a/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 b/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 index 772f544..3ffe829 100644 --- a/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 +++ b/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 @@ -32,3 +32,11 @@ jobs: run: | cd openmc_install_scripts/Ubuntu_22.04 ./openmc-install.sh + - name: cad-to-openmc-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./cad-to-openmc-install.sh + - name: test-install + run: | + cd openmc_install_scripts/tests + ./run-test.sh \ No newline at end of file diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..4433fdb --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,48 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + workflow_dispatch: + schedule: + - cron: '44 4 * * 0' +jobs: + run-openmc-installer: + runs-on: ubuntu-22.04 + steps: + - name: checkout_main_repo + uses: actions/checkout@v3 + with: + repository: 'openmsr/openmc_install_scripts' + ref: '${{github.sha}}' + path: openmc_install_scripts + submodules: true + - name: bootstrap + run: sudo apt-get -y update + - name: moab-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./moab-install.sh + - name: double_down-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./double_down-install.sh + - name: dagmc-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./dagmc-install.sh + - name: openmc-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./openmc-install.sh + - name: cad-to-openmc-install + run: | + cd openmc_install_scripts/Ubuntu_22.04 + ./cad-to-openmc-install.sh + - name: test-install + run: | + sudo apt-get install libgl1-mesa-glx libglu1-mesa libxcursor1 libxinerama1 + sudo pip install -U numpy + cd openmc_install_scripts/tests + ./run-test.sh diff --git a/Arch/tests/step_to_h5m.py b/Arch/tests/step_to_h5m.py deleted file mode 100644 index 9bea427..0000000 --- a/Arch/tests/step_to_h5m.py +++ /dev/null @@ -1,9 +0,0 @@ -import sys -import os -home=os.path.expanduser('~') -sys.path.append(f'{home}/openmc/CAD_to_openMC/CAD_to_openMC/src') -import CAD_to_OpenMC.assembly as ab -a=ab.Assembly() -a.stp_files=["tests/fuel_pins.step"] -a.import_stp_files() -a.solids_to_h5m() diff --git a/Ubuntu_22.04/cad-to-openmc-install.sh b/Ubuntu_22.04/cad-to-openmc-install.sh new file mode 100755 index 0000000..873e304 --- /dev/null +++ b/Ubuntu_22.04/cad-to-openmc-install.sh @@ -0,0 +1,32 @@ +################################################################################ +#CAD_to_openMC install +################################################################################ +#!/bin/bash +set -ex + +WD=`pwd` +name=`basename $0` +package_name='CAD_to_openMC' + +#install_prefix="/opt" +#build_prefix="$HOME/openmc" + +#if there is a .done-file then skip this step +if [ ! -e ${name}.done ]; then + mkdir -p $HOME/openmc + cd $HOME/openmc + if [ ! -e CAD_to_openMC ]; then + git clone https://github.com/openmsr/CAD_to_openMC.git + else + cd CAD_to_openMC + git fetch + git pull + cd .. + fi + cd ${WD} + touch ${name}.done +else + echo CAD_to_openMC appears already to be installed \(lock file ${name}.done exists\) - skipping. +fi + +sudo pip install -r $HOME/openmc/CAD_to_openMC/requirements.txt diff --git a/Ubuntu_22.04/dagmc-install.sh b/Ubuntu_22.04/dagmc-install.sh index 3054f97..75e6765 100755 --- a/Ubuntu_22.04/dagmc-install.sh +++ b/Ubuntu_22.04/dagmc-install.sh @@ -25,8 +25,19 @@ if [ ! -e ${name}.done ]; then mkdir -p $HOME/openmc/DAGMC cd $HOME/openmc/DAGMC - git clone --single-branch --branch develop --depth 1 https://github.com/svalinn/DAGMC.git - mkdir build + if [ ! -e DAGMC ]; then + git clone --single-branch --branch develop --depth 1 https://github.com/svalinn/DAGMC.git + else + cd DAGMC + git checkout develop + git fetch + git pull + cd .. + fi + + if [ ! -e build ]; then + mkdir build + fi cd build cmake ../DAGMC -DBUILD_TALLY=ON \ -DMOAB_DIR=$HOME/openmc/MOAB \ diff --git a/Ubuntu_22.04/double_down-install.sh b/Ubuntu_22.04/double_down-install.sh index 4d69880..167bd6a 100755 --- a/Ubuntu_22.04/double_down-install.sh +++ b/Ubuntu_22.04/double_down-install.sh @@ -4,9 +4,13 @@ #!/bin/bash set -ex -#embree compile & install -#./embree-install.sh -#echo "Compiled & installed embree, proceeding..." +# uncomment to install embree or define as an environmental variable +# BUILD_EMBREE=1 +# embree compile & install +if [ $BUILD_EMBREE ]; then + ./embree-install.sh + echo "Compiled & installed embree, proceeding..." +fi #moab compile & install ./moab-install.sh @@ -29,11 +33,24 @@ if [ ! -e ${name}.done ]; then mkdir -p $HOME/openmc/double-down cd $HOME/openmc/double-down - git clone --single-branch --branch main --depth 1 https://github.com/pshriwise/double-down.git - mkdir build + if [ ! -e double-down ]; then + git clone --single-branch --branch main --depth 1 https://github.com/pshriwise/double-down.git + else + cd double-down; + git checkout main + git fetch + git pull + cd .. + fi + if [ ! -e build ]; then + mkdir build + fi + cd build - cmake ../double-down -DMOAB_DIR=$HOME/openmc/MOAB \ - -DCMAKE_INSTALL_PREFIX=$HOME/openmc/double-down + cmake ../double-down \ + -DMOAB_DIR=$HOME/openmc/MOAB \ + $(if [ $BUILD_EMBREE ]; then echo "-DEMBREE_DIR=$HOME/openmc/embree"; fi) \ + -DCMAKE_INSTALL_PREFIX=$HOME/openmc/double-down make -j $ccores make install diff --git a/Ubuntu_22.04/embree-install.sh b/Ubuntu_22.04/embree-install.sh index 2c714d3..0c60904 100755 --- a/Ubuntu_22.04/embree-install.sh +++ b/Ubuntu_22.04/embree-install.sh @@ -31,15 +31,22 @@ if [ ! -e $0.done ]; then cd openmc mkdir -p embree cd embree - git clone --single-branch --branch v3.13.3 --depth 1 https://github.com/embree/embree.git - mkdir build + if [ ! -e embree ]; then + git clone --single-branch --branch v3.13.3 --depth 1 https://github.com/embree/embree.git + else + cd embree + git checkout v3.13.3 + git fetch + git pull + cd .. + fi + mkdir -p build cd build cmake ../embree -DCMAKE_INSTALL_PREFIX=$HOME/openmc/embree \ -DEMBREE_ISPC_SUPPORT=OFF \ - -DEMBREE_TUTORIALS=OFF + -DEMBREE_TUTORIALS=OFF make -j $ccores - sudo make install - rm -rf embree/build embree/embree + make install cd ${WD} touch ${0}.done diff --git a/Ubuntu_22.04/install-all.sh b/Ubuntu_22.04/install-all.sh index b3238f1..390e709 100755 --- a/Ubuntu_22.04/install-all.sh +++ b/Ubuntu_22.04/install-all.sh @@ -8,8 +8,5 @@ echo 'Defaults timestamp_timeout=-1' | sudo EDITOR='tee -a' visudo ./openmc-install.sh echo "Compiled & installed openmc, done." -echo "Running test script..." -python test_openmc.py - -#remove timestamp update -sudo sed -i '/Defaults timestamp_timeout=-1/d' /etc/sudoers +./cad-to-openmc-install.sh +echo "Compiled & installed CAD_to_openMC, done." \ No newline at end of file diff --git a/Ubuntu_22.04/moab-install.sh b/Ubuntu_22.04/moab-install.sh index d5f9ef9..daf9d74 100755 --- a/Ubuntu_22.04/moab-install.sh +++ b/Ubuntu_22.04/moab-install.sh @@ -35,15 +35,28 @@ if [ ! -e ${name}.done ]; then mkdir -p $HOME/openmc/MOAB cd $HOME/openmc/MOAB - git clone --single-branch --branch 5.3.1 --depth 1 https://bitbucket.org/fathomteam/moab.git - mkdir -p build + + if [ ! -e moab ]; then + git clone --single-branch --branch 5.3.1 --depth 1 https://bitbucket.org/fathomteam/moab.git + else + cd moab && \ + git checkout 5.3.1 && \ + git fetch && \ + git pull && \ + cd .. + fi + + if [ ! -e build ]; then + mkdir -p build + fi + cd build cmake ../moab -DENABLE_HDF5=ON \ -DENABLE_NETCDF=ON \ -DENABLE_FORTRAN=OFF \ -DENABLE_BLASLAPACK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DENABLE_PYMOAB=OFF \ + -DENABLE_PYMOAB=ON \ -DCMAKE_INSTALL_PREFIX=$HOME/openmc/MOAB make -j $ccores make install diff --git a/Ubuntu_22.04/openmc-install.sh b/Ubuntu_22.04/openmc-install.sh index 51e1047..9ede235 100755 --- a/Ubuntu_22.04/openmc-install.sh +++ b/Ubuntu_22.04/openmc-install.sh @@ -5,8 +5,8 @@ set -ex #nuclear_data_download -#./nuclear_data-install.sh -#echo "Downloaded & extracted nuclear data, proceeding..." +./nuclear_data-install.sh +echo "Downloaded & extracted nuclear data, proceeding..." #dagmc compile & install ./dagmc-install.sh @@ -50,12 +50,11 @@ if [ ! -e ${name}.done ]; then cd build cmake -DOPENMC_USE_DAGMC=ON \ -DDAGMC_ROOT=$HOME/openmc/DAGMC \ - -DHDF5_PREFER_PARALLEL=off .. + -DHDF5_PREFER_PARALLEL=off \ + -DCMAKE_INSTALL_PREFIX=$HOME/openmc \ + .. make -j $ccores - sudo make install - - cd .. - sudo pip3 install . + make install cd ${WD} diff --git a/Arch/tests/fuel_pins.step b/tests/fuel_pins.step similarity index 100% rename from Arch/tests/fuel_pins.step rename to tests/fuel_pins.step diff --git a/tests/run-test.sh b/tests/run-test.sh new file mode 100755 index 0000000..080f131 --- /dev/null +++ b/tests/run-test.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +echo "Running test script..." +# set the path to the nuclear database +export OPENMC_CROSS_SECTIONS=$HOME"/openmc/nuclear_data/mcnp_endfb71/cross_sections.xml" +# set custom version of pyMOAB +export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/MOAB/build/pymoab/" +# set custom version of CAD_to_openMC +export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/CAD_to_openMC/src/" +# set custom version of OpenMC +export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/openmc/" +export PATH=$PATH:$HOME"/openmc/openmc/build/bin/" + +if [ ! -e dagmc.h5m ]; then + python step_to_h5m.py fuel_pins.step +fi +python test_openmc.py diff --git a/tests/step_to_h5m.py b/tests/step_to_h5m.py new file mode 100644 index 0000000..a893988 --- /dev/null +++ b/tests/step_to_h5m.py @@ -0,0 +1,8 @@ +import sys +import os +import CAD_to_OpenMC.assembly as ab + +a=ab.Assembly() +a.stp_files=[sys.argv[1]] +a.import_stp_files() +a.solids_to_h5m() diff --git a/Arch/tests/test_openmc.py b/tests/test_openmc.py similarity index 100% rename from Arch/tests/test_openmc.py rename to tests/test_openmc.py