From 286990fe0c9849fa66aa2c551ffbeeeb88df7853 Mon Sep 17 00:00:00 2001 From: Daniel Kozma Date: Sat, 26 Nov 2022 17:38:00 +0100 Subject: [PATCH 1/7] non-system installs and test --- .../build_from_source_on_Ubuntu_jammy_22.04 | 8 +++++ Arch/tests/step_to_h5m.py | 9 ------ Ubuntu_22.04/cad-to-openmc-install.sh | 30 ++++++++++++++++++ Ubuntu_22.04/dagmc-install.sh | 15 +++++++-- Ubuntu_22.04/double_down-install.sh | 31 ++++++++++++++----- Ubuntu_22.04/embree-install.sh | 17 +++++++--- Ubuntu_22.04/install-all.sh | 7 ++--- Ubuntu_22.04/moab-install.sh | 17 ++++++++-- Ubuntu_22.04/openmc-install.sh | 13 ++++---- {Arch/tests => tests}/fuel_pins.step | 0 tests/run-test.sh | 15 +++++++++ tests/step_to_h5m.py | 8 +++++ {Arch/tests => tests}/test_openmc.py | 0 13 files changed, 133 insertions(+), 37 deletions(-) delete mode 100644 Arch/tests/step_to_h5m.py create mode 100755 Ubuntu_22.04/cad-to-openmc-install.sh rename {Arch/tests => tests}/fuel_pins.step (100%) create mode 100644 tests/run-test.sh create mode 100644 tests/step_to_h5m.py rename {Arch/tests => tests}/test_openmc.py (100%) 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..97cbf3e 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 tests + ./run-test.sh \ No newline at end of file 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..453acd5 --- /dev/null +++ b/Ubuntu_22.04/cad-to-openmc-install.sh @@ -0,0 +1,30 @@ +################################################################################ +#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 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..43413ce 100755 --- a/Ubuntu_22.04/moab-install.sh +++ b/Ubuntu_22.04/moab-install.sh @@ -35,8 +35,21 @@ 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 \ 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 100644 index 0000000..11cf2c0 --- /dev/null +++ b/tests/run-test.sh @@ -0,0 +1,15 @@ +#! /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 CAD_to_openMC +export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/CAD_to_openMC/src/" +# set custom version of OpenMC +export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/openmc/" + + +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 From 859ac657e727a8f1b2af7f45364c8f6976645de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Kozma?= Date: Sat, 26 Nov 2022 17:50:25 +0100 Subject: [PATCH 2/7] action added, tests path fixed --- .github/workflows/python-app.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..cdecc04 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,46 @@ +# 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: | + cd openmc_install_scripts/tests + ./run-test.sh From 4ff74ec73cdde741512a7945ae231afb96cf5e8e Mon Sep 17 00:00:00 2001 From: Daniel Kozma Date: Sat, 26 Nov 2022 18:10:30 +0100 Subject: [PATCH 3/7] chmod +x run-test.sh, install CAD_to_openMC python requirements --- .github/workflows/build_from_source_on_Ubuntu_jammy_22.04 | 2 +- Ubuntu_22.04/cad-to-openmc-install.sh | 2 ++ tests/run-test.sh | 0 3 files changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 tests/run-test.sh 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 97cbf3e..3ffe829 100644 --- a/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 +++ b/.github/workflows/build_from_source_on_Ubuntu_jammy_22.04 @@ -38,5 +38,5 @@ jobs: ./cad-to-openmc-install.sh - name: test-install run: | - cd tests + cd openmc_install_scripts/tests ./run-test.sh \ No newline at end of file diff --git a/Ubuntu_22.04/cad-to-openmc-install.sh b/Ubuntu_22.04/cad-to-openmc-install.sh index 453acd5..873e304 100755 --- a/Ubuntu_22.04/cad-to-openmc-install.sh +++ b/Ubuntu_22.04/cad-to-openmc-install.sh @@ -28,3 +28,5 @@ if [ ! -e ${name}.done ]; then 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/tests/run-test.sh b/tests/run-test.sh old mode 100644 new mode 100755 From a3145a1b0bde88861ac1f0e956ff34a026d4d5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Kozma?= Date: Sat, 26 Nov 2022 18:57:05 +0100 Subject: [PATCH 4/7] fixing missing libGLU.so.1 in workflow --- .github/workflows/python-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index cdecc04..50cc6f6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -42,5 +42,6 @@ jobs: ./cad-to-openmc-install.sh - name: test-install run: | + sudo apt-get install libgl1-mesa-glx cd openmc_install_scripts/tests ./run-test.sh From 1277efc9a2c6bca65e58e19dfd0195756e7b733f Mon Sep 17 00:00:00 2001 From: Daniel Kozma Date: Sat, 26 Nov 2022 22:07:57 +0100 Subject: [PATCH 5/7] path, flag fixes --- .github/workflows/python-app.yml | 2 +- Ubuntu_22.04/moab-install.sh | 2 +- tests/run-test.sh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 50cc6f6..8e21893 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -42,6 +42,6 @@ jobs: ./cad-to-openmc-install.sh - name: test-install run: | - sudo apt-get install libgl1-mesa-glx + sudo apt-get install libgl1-mesa-glx libglu1-mesa libxcursor1 libxinerama1 cd openmc_install_scripts/tests ./run-test.sh diff --git a/Ubuntu_22.04/moab-install.sh b/Ubuntu_22.04/moab-install.sh index 43413ce..daf9d74 100755 --- a/Ubuntu_22.04/moab-install.sh +++ b/Ubuntu_22.04/moab-install.sh @@ -56,7 +56,7 @@ if [ ! -e ${name}.done ]; then -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/tests/run-test.sh b/tests/run-test.sh index 11cf2c0..4774311 100755 --- a/tests/run-test.sh +++ b/tests/run-test.sh @@ -3,6 +3,8 @@ 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 From b1ec1e9a059389a3ea0877dc2c2af01c08f402cd Mon Sep 17 00:00:00 2001 From: Daniel Kozma Date: Sat, 26 Nov 2022 23:32:47 +0100 Subject: [PATCH 6/7] adding openmc to $PATH --- tests/run-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-test.sh b/tests/run-test.sh index 4774311..080f131 100755 --- a/tests/run-test.sh +++ b/tests/run-test.sh @@ -9,7 +9,7 @@ export PYTHONPATH=$PYTHONPATH:$HOME"/openmc/MOAB/build/pymoab/" 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 From ba14d63b25ebaf430971126b1af84d9b117ffeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Kozma?= Date: Sun, 27 Nov 2022 00:31:45 +0100 Subject: [PATCH 7/7] numpy upgade in workflow to fix API version error RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe --- .github/workflows/python-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 8e21893..4433fdb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -43,5 +43,6 @@ jobs: - 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