Skip to content

Commit

Permalink
Merge pull request #1546 from willend/main
Browse files Browse the repository at this point in the history
"Deep" examples structure, work on mctest util plus various
  • Loading branch information
willend authored Jan 18, 2024
2 parents 585419c + 331ab05 commit 121761e
Show file tree
Hide file tree
Showing 403 changed files with 1,816 additions and 1,570 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/mcstas-basictest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:
run: |
sudo apt -y install libopenmpi-dev
- name: Setup OpenMPI (macOS-12)
- name: Setup OpenMPI (macOS-12,13)
id: setup-openmpi-macos12
if: matrix.os == 'macos-12'
if: runner.os == 'macOS' && matrix.os != 'macos-11'
run: |
brew install openmpi
Expand Down Expand Up @@ -163,13 +163,13 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_BNL_H8 && cd run_BNL_H8
cp ../install_mcstas/share/mcstas/resources/examples/BNL_H8.instr .
cp ../install_mcstas/share/mcstas/resources/examples/Brookhaven/BNL_H8/BNL_H8.instr .
../install_mcstas/bin/${MCRUN_EXECUTABLE} BNL_H8.instr lambda=2.36
../install_mcstas/bin/${MCSTAS_PYGEN_EXECUTABLE} BNL_H8.instr
- name: Launch BNL_H8 instrument (MPI)
id: h8-test-mpi
if: runner.os == 'Linux' || matrix.os == 'macos-12' # Linux or macos-12 only
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
run: |
set -e
set -u
Expand All @@ -180,7 +180,7 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_BNL_H8_mpi && cd run_BNL_H8_mpi
cp ../install_mcstas/share/mcstas/resources/examples/BNL_H8.instr .
cp ../install_mcstas/share/mcstas/resources/examples/Brookhaven/BNL_H8/BNL_H8.instr .
../install_mcstas/bin/${MCRUN_EXECUTABLE} --mpi=2 BNL_H8.instr lambda=2.36
- name: Launch MCPL test instrument
Expand All @@ -197,12 +197,12 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_ESS_BEER_MCPL && cd run_ESS_BEER_MCPL
cp ../install_mcstas/share/mcstas/resources/examples/ESS_BEER_MCPL.instr .
cp ../install_mcstas/share/mcstas/resources/examples/ESS/ESS_BEER_MCPL/ESS_BEER_MCPL.instr .
../install_mcstas/bin/${MCRUN_EXECUTABLE} ESS_BEER_MCPL.instr repetition=50
- name: Launch MCPL test instrument (mpi)
id: mcpl-test-mpi
if: runner.os == 'Linux' || matrix.os == 'macos-12' # Linux or macos-12 only
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
# Status: Works on Unixes ("wrapper batches missing for Windows")
run: |
set -e
Expand All @@ -214,7 +214,7 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_ESS_BEER_MCPL_mpi && cd run_ESS_BEER_MCPL_mpi
cp ../install_mcstas/share/mcstas/resources/examples/ESS_BEER_MCPL.instr .
cp ../install_mcstas/share/mcstas/resources/examples/ESS/ESS_BEER_MCPL/ESS_BEER_MCPL.instr .
../install_mcstas/bin/${MCRUN_EXECUTABLE} --mpi=2 ESS_BEER_MCPL.instr repetition=100
- name: Launch NCrystal test instrument
Expand All @@ -231,12 +231,12 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_NCrystal_example && cd run_NCrystal_example
cp ../install_mcstas/share/mcstas/resources/examples/NCrystal_example.instr .
cp ../install_mcstas/share/mcstas/resources/examples/NCrystal/NCrystal_example/NCrystal_example.instr .
../install_mcstas/bin/${MCRUN_EXECUTABLE} NCrystal_example.instr sample_cfg="Y2O3_sg206_Yttrium_Oxide.ncmat\;density=0.6x"
- name: Launch NCrystal test instrument (mpi)
id: ncrystal-test-mpi
if: runner.os == 'Linux' || matrix.os == 'macos-12' # Linux or macos-12 only
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
# Status: Works on Unixes ("ncrystal missing for Windows")
run: |
set -e
Expand All @@ -248,7 +248,7 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_NCrystal_example_mpi && cd run_NCrystal_example_mpi
cp ../install_mcstas/share/mcstas/resources/examples/NCrystal_example.instr .
cp ../install_mcstas/share/mcstas/resources/examples/NCrystal/NCrystal_example/NCrystal_example.instr .
clang --version
mpirun --version
ncrystal-config --version
Expand All @@ -275,7 +275,7 @@ jobs:
test -f ./install_mcstas/bin/${MCSTAS_EXECUTABLE}
./install_mcstas/bin/${MCSTAS_EXECUTABLE} --version
mkdir run_templateSANS_Mantid && cd run_templateSANS_Mantid
cp ../install_mcstas/share/mcstas/resources/examples/templateSANS_Mantid.instr .
cp ../install_mcstas/share/mcstas/resources/examples/Mantid/templateSANS_Mantid/templateSANS_Mantid.instr .
#Not a final solution!!!:
#if [ "x$(uname)" == "xDarwin" ]; then export MCSTAS_CC_OVERRIDE=/usr/bin/clang; fi
if [ "x$(uname)" == "xLinux" ]; then
Expand Down
173 changes: 173 additions & 0 deletions .github/workflows/mcstas-testsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: mcstas-testsuite
on:

workflow_dispatch:
inputs:
manual-debugging:
type: boolean
description: Launch manual debugging tmate for inspection (automatic in case of errors)
default: false

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, CC: clang, CXX: clang++, python: '3.11' }
# Drop macOS, takes much too long time executing
# - { os: macos-13, CC: clang, CXX: clang++, python: "3.11" }

name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
defaults:
run:
shell: bash -el {0}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Setup Bison (macOS)
id: setup-flex-bison-macos
if: runner.os == 'macOS'
run: |
brew install bison flex
- name: Setup Bison (Windows)
id: setup-flex-bison-Windows
if: runner.os == 'Windows'
run: |
choco install winflexbison3
- name: Setup OpenMPI (Linux)
id: setup-openmpi-nexus-linux
if: runner.os == 'Linux'
run: |
sudo apt -y install libopenmpi-dev libnexus-dev curl
sudo curl -O https://packages.mccode.org/debian/dists/stable/main/binary-amd64/mcpl-1.6.2-deb64.deb
sudo dpkg -i mcpl-1.6.2-deb64.deb
sudo apt-get -f install
- name: Setup OpenMPI (macOS-12,13)
id: setup-openmpi-macos
if: runner.os == 'macOS' && matrix.os != 'macos-11'
run: |
set -e
set -u
set -x
brew install openmpi
- name: Check versions
id: version-checks
run: |
which python3
python3 --version
which cmake
cmake --version
#NB: bison and flex in path are actually too old, on mac we
#inject these via a brew keg later
- name: Configure build and install mcstas
id: mcstas-install
run: |
if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi
set -e
set -u
set -x
mkdir build_mcstas
cd build_mcstas
export EXTRA_ARGS_FOR_CMAKE=""
if [ "$RUNNER_OS" == "macOS" ]; then export EXTRA_ARGS_FOR_CMAKE="-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex"; fi
if [ "$RUNNER_OS" == "Linux" ]; then export EXTRA_ARGS_FOR_CMAKE="-DNEXUSLIB=/usr/lib -DNEXUSINCLUDE=/usr/include/nexus"; fi
cmake \
-DCMAKE_INSTALL_PREFIX=../install_mcstas \
-S ../src \
-G "Unix Makefiles" \
-DMCVERSION="3.99.99" \
-DMCCODE_BUILD_CONDA_PKG=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_MCSTAS=ON \
-DMCCODE_USE_LEGACY_DESTINATIONS=OFF \
-DBUILD_TOOLS=ON \
-DENABLE_COMPONENTS=ON \
-DENSURE_MCPL=ON \
-DENSURE_NCRYSTAL=OFF \
-DENABLE_CIF2HKL=OFF \
-DENABLE_NEUTRONICS=OFF \
${EXTRA_ARGS_FOR_CMAKE}
cmake --build . --config Release
cmake --build . --target install --config Release
export MCSTAS_EXECUTABLE="mcstas"
export MCRUN_EXECUTABLE="mcrun"
if [ "$RUNNER_OS" == "Windows" ];
then
export MCSTAS_EXECUTABLE="mcstas.exe"
export MCRUN_EXECUTABLE="mcrun.bat"
fi
test -f "../install_mcstas/bin/${MCSTAS_EXECUTABLE}"
test -f "../install_mcstas/bin/${MCRUN_EXECUTABLE}"
test -f "../install_mcstas/share/mcstas/tools/Python/mccodelib/__init__.py"
test -d "../install_mcstas/share/mcstas/resources/data"
echo *******************************************************************************
echo Resulting mccode_config.json:
echo *******************************************************************************
cat ../install_mcstas/share/mcstas/tools/Python/mccodelib/mccode_config.json
echo *******************************************************************************
- name: Pip install various
id: pip-install
run: |
set -e
set -u
set -x
python3 -mpip install PyYAML ply McStasscript
if [ "$RUNNER_OS" != "Windows" ];
then
python3 -mpip install ncrystal
fi
- name: Test suite, 2-core MPI
id: test-suite
run: |
set -e
set -u
set -x
export PATH=$PWD/install_mcstas/bin/:$PATH
mkdir run_test-suite && cd run_test-suite
mctest --testdir $PWD --mpi=2 --suffix ${{ matrix.os }}
- name: 'Tar output files'
id: tar-package
if: always()
run: |
set -e
set -u
set -x
tar cvfz mcstas-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}_output.tgz run_*
- name: 'Upload Artifact'
id: tar-upload
uses: actions/upload-artifact@v3
if: always()
with:
name: mcstas-artefacts
path: "*_output.tgz"

- name: Setup tmate session for manual debugging
uses: mxschmitt/action-tmate@v3
if: always() && (inputs.manual-debugging == true && steps.tar-package.outcome != 'success')
with:
limit-access-to-actor: true
16 changes: 8 additions & 8 deletions .github/workflows/mcxtrace-basictest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:
run: |
sudo apt -y install libopenmpi-dev
- name: Setup OpenMPI (macOS-12)
- name: Setup OpenMPI (macOS-12,13)
id: setup-openmpi-macos12
if: matrix.os == 'macos-12'
if: runner.os == 'macOS' && matrix.os != 'macos-11'
run: |
brew install openmpi
Expand Down Expand Up @@ -158,13 +158,13 @@ jobs:
test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}
./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version
mkdir run_JJ_SAXS && cd run_JJ_SAXS
cp ../install_mcxtrace/share/mcxtrace/resources/examples/JJ_SAXS.instr .
cp ../install_mcxtrace/share/mcxtrace/resources/examples/SAXSLAB/JJ_SAXS/JJ_SAXS.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} JJ_SAXS.instr pin2_pos=0.2 pin3_pos=0.4 optic_L=0.1 sample_pos=0.2 detector_pos=2
../install_mcxtrace/bin/${MCXTRACE_PYGEN_EXECUTABLE} JJ_SAXS.instr
- name: Launch JJ_SAXS instrument (MPI)
id: JJ_SAXS-mpi
if: runner.os == 'Linux' || matrix.os == 'macos-12' # Linux or macos-12 only
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
run: |
set -e
set -u
Expand All @@ -175,7 +175,7 @@ jobs:
test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}
./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version
mkdir run_JJ_SAXS_mpi && cd run_JJ_SAXS_mpi
cp ../install_mcxtrace/share/mcxtrace/resources/examples/JJ_SAXS.instr .
cp ../install_mcxtrace/share/mcxtrace/resources/examples/SAXSLAB/JJ_SAXS/JJ_SAXS.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} --mpi=2 JJ_SAXS.instr pin2_pos=0.2 pin3_pos=0.4 optic_L=0.1 sample_pos=0.2 detector_pos=2
- name: Launch MCPL test instrument
Expand All @@ -192,12 +192,12 @@ jobs:
test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}
./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version
mkdir run_Test_MCPL_input && cd run_Test_MCPL_input
cp ../install_mcxtrace/share/mcxtrace/resources/examples/Test_MCPL_input.instr .
cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests/Test_MCPL_input/Test_MCPL_input.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} Test_MCPL_input.instr repeat=10
- name: Launch MCPL test instrument (MPI)
id: mcpl-test-mpi
if: runner.os == 'Linux' || matrix.os == 'macos-12' # Linux or macos-12 only
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
# Status: Works on Unixes ("wrapper batches missing for Windows")
run: |
set -e
Expand All @@ -209,7 +209,7 @@ jobs:
test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}
./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version
mkdir run_Test_MCPL_input_mpi && cd run_Test_MCPL_input_mpi
cp ../install_mcxtrace/share/mcxtrace/resources/examples/Test_MCPL_input.instr .
cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests/Test_MCPL_input/Test_MCPL_input.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} --mpi=2 Test_MCPL_input.instr repeat=20
- name: 'Tar output files'
Expand Down
15 changes: 13 additions & 2 deletions buildscripts/build_loc_3.x_mac_conda
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,29 @@ if [[ ! -d $CONDALOCATION ]]; then
echo "* Downloading python dependencies to embedded miniconda *"
echo "*********************************************************"
echo
export PATH=$CONDALOCATION/bin:$PATH
export PATH=$CONDALOCATION/bin:$PATH
source $CONDALOCATION/bin/activate
which conda
mamba update mamba -y
mamba install -c conda-forge --override-channels cmake compilers gsl pyaml ply matplotlib numpy tornado scipy pillow pyqtgraph pyqt nomkl qscintilla2 nexusformat nexpy hdf5 openmpi mcpl ncrystal -y
mamba install -c conda-forge --override-channels cmake compilers flex bison gsl pyaml ply matplotlib numpy tornado scipy pillow pyqtgraph pyqt nomkl qscintilla2 nexusformat nexpy hdf5 openmpi mcpl ncrystal -y
mamba clean --all -y
echo CMAKE:
which cmake
else
source $CONDALOCATION/bin/activate
which conda
echo CMAKE:
which cmake
fi


export PATH=$CONDALOCATION/bin:$PATH

./mkdist mcstas 3.x-dev "" "" mac "" -- justinst
./mkdist mcstas-comps 3.x-dev "" "" mac "" -- justinst
./mkdist mcstas-tools-python-mcrun 3.x-dev tools/Python/mcrun/ "" mac "" -- justinst
./mkdist mcstas-tools-python-mcdoc 3.x-dev tools/Python/mcdoc/ "" mac "" -- justinst
./mkdist mcstas-tools-python-mctest 3.x-dev tools/Python/mctest/ "" mac "" -- justinst
./mkdist mcstas-tools-python-mcgui 3.x-dev tools/Python/mcgui/ "" mac "" -- justinst
./mkdist mcstas-tools-python-mccodelib 3.x-dev tools/Python/mccodelib/ "" mac "" -- justinst
./mkdist mcstas-tools-python-mcdisplay-pyqtgraph 3.x-dev tools/Python/mcdisplay/pyqtgraph/ "" mac "" -- justinst
Expand Down
1 change: 1 addition & 0 deletions buildscripts/build_loc_3.x_tree
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export PATH=$CONDALOCATION/bin:$PATH
./mkdist mcstas-tools-python-mcgui 3.x-dev tools/Python/mcgui/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mcrun 3.x-dev tools/Python/mcrun/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mcdoc 3.x-dev tools/Python/mcdoc/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mctest 3.x-dev tools/Python/mctest/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mccodelib 3.x-dev tools/Python/mccodelib/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mcdisplay-pyqtgraph 3.x-dev tools/Python/mcdisplay/pyqtgraph/ "" deb64 "" -- justinst
./mkdist mcstas-tools-python-mcdisplay-webgl 3.x-dev tools/Python/mcdisplay/webgl/ "" deb64 "" -- justinst
Expand Down
Loading

0 comments on commit 121761e

Please sign in to comment.