Skip to content

Commit

Permalink
Merge branch 'pyqtgraph-replacement-in-webgl-upgrade' of https://gith…
Browse files Browse the repository at this point in the history
…ub.com/theogutt/McStas3D into pyqtgraph-replacement-in-webgl-upgrade
  • Loading branch information
theogutt committed Jul 4, 2024
2 parents 1d95c00 + a8c13fa commit 6ba8cf5
Show file tree
Hide file tree
Showing 55 changed files with 702 additions and 245 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/mcstas-testsuite.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: mcstas-testsuite
on:
schedule:
- cron: '00 02 * * *' # 02:00 every day

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -49,12 +51,13 @@ jobs:
choco install winflexbison3
- name: Setup OpenMPI (Linux)
id: setup-openmpi-nexus-linux
id: setup-openmpi-nexus-linux-gsl
if: runner.os == 'Linux'
run: |
sudo apt -y install libopenmpi-dev libnexus-dev curl
sudo apt -y install libopenmpi-dev libnexus-dev curl libgsl-dev
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 curl -O https://packages.mccode.org/debian/dists/stable/main/binary-amd64/ncrystal-3.7.1-deb64.deb
sudo dpkg -i mcpl-1.6.2-deb64.deb ncrystal-3.7.1-deb64.deb
sudo apt-get -f install
- name: Setup OpenMPI (macOS-12,13)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mcxtrace-autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ jobs:
set -x
cd McCode
export REV=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin 'v*.*.*' | tail -1 | cut -f3 -d/ | cut -f2 -dv`
if [ "$RUNNER_OS" == "macOS" ]; then ./buildscripts/build_macos_mcstas ${REV}; fi
if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcstas ${REV} meta; fi
if [ "$RUNNER_OS" == "macOS" ]; then ./buildscripts/build_macos_mcxtrace ${REV}; fi
if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcxtrace ${REV} meta; fi
tar cfz dist-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}.tgz dist/
- name: Cross-Build McXtrace for windows
Expand Down
173 changes: 173 additions & 0 deletions .github/workflows/mcxtrace-testsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: mcxtrace-testsuite
on:
schedule:
- cron: '00 01 * * *' # 01:00 every day

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' }

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@v5
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-gsl-xraylib
if: runner.os == 'Linux'
run: |
sudo apt -y install libopenmpi-dev libnexus-dev curl libgsl-dev libxrl-dev
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 mcxtrace
id: mcxtrace-install
run: |
if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi
set -e
set -u
set -x
mkdir build_mcxtrace
cd build_mcxtrace
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_mcxtrace \
-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_MCXTRACE=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 MCXTRACE_EXECUTABLE="mcxtrace"
export MXRUN_EXECUTABLE="mxrun"
if [ "$RUNNER_OS" == "Windows" ];
then
export MCXTRACE_EXECUTABLE="mcxtrace.exe"
export MXRUN_EXECUTABLE="mxrun.bat"
fi
test -f "../install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}"
test -f "../install_mcxtrace/bin/${MXRUN_EXECUTABLE}"
test -f "../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/__init__.py"
test -d "../install_mcxtrace/share/mcxtrace/resources/data"
echo *******************************************************************************
echo Resulting mccode_config.json:
echo *******************************************************************************
cat ../install_mcxtrace/share/mcxtrace/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_mcxtrace/bin/:$PATH
mkdir run_test-suite && cd run_test-suite
mxtest --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 mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}_output.tgz run_*
- name: 'Upload Artifact'
id: tar-upload
uses: actions/upload-artifact@v4
if: always()
with:
name: mcxtrace-artefacts-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
path: "mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}_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
18 changes: 7 additions & 11 deletions INSTALL-McStas-3.x/Windows/WSL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
*(WSL is the Windows Subsystem for Linux, aka. bash on Ubuntu on Windows)*


## Enable bash
(From https://stackoverflow.com/questions/3.4.3627/how-to-enable-bash-in-windows-10-developer-preview)
* Click the Start button,
* Write Control Panel and start the Control Panel app
* Click Programs
* Click Turn Windows features on or off
* Enable Windows Subsystem for Linux
* Let the machine reboot if necessary
## Enable WSL / Ubuntu:
* Open the Windows store
* Search for Ubuntu
* Install e.g. Ubuntu 22.04 LTS (other Linuxes are also
Expand All @@ -23,11 +16,14 @@ the start menu
[normal Debian installation instructions](../../Linux/debian/README.md)
- essentially a matter of sudo apt-get install mcstas-suite-python mcstas-suite-python-ng

## Install Xming or another X11 server application
## For WSL 2.0: Use WSLg
* Please try to upgrade WSL to v. 2.0 or later which should install [WSLg graphical support (X11)](https://github.com/microsoft/wslg)

## For WSL 1: Install Xming or another X11 server application
* Download and install Xming via https://sourceforge.net/projects/xming/
* Windows store also provides a $-ware called X410 from "Choung Networks"

## Optionally add a few commands at the end of your .bashrc:
## For WSL 1: Optionally add a few commands at the end of your .bashrc:
```bash
cd $HOME
nano .bashrc
Expand All @@ -49,7 +45,7 @@ export LIBGL_ALWAYS_INDIRECT=1

## Start mcgui
* Ensure your X11 server is running
* Start bash and ensure the DISPLAY variable is set (export
* For WSL 1: Start bash and ensure the DISPLAY variable is set (export
DISPLAY=:0.0)
* Issue the command mcgui

Expand Down
2 changes: 1 addition & 1 deletion buildscripts/build_loc_3.x_mac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-$(python3 -c "im
# rapid-build script for mcstas-kernel dev:


git checkout main
#git checkout main
git pull

# Ensure our 3rd party modules are in place and updated
Expand Down
1 change: 0 additions & 1 deletion buildscripts/build_loc_3.x_tree
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ if [[ ! -d $CONDALOCATION ]]; then
export PATH=$CONDALOCATION/bin:$PATH
mamba update mamba -y
mamba install cmake compilers gsl pyaml ply matplotlib numpy tornado scipy pillow pyqtgraph pyqt nomkl qscintilla2 nexusformat nexpy hdf5 nexus mcpl ncrystal -y
#mamba install gsl pyaml ply matplotlib numpy tornado scipy pillow pyqtgraph pyqt nomkl qscintilla2 nexusformat nexpy hdf5 -y
mamba clean --all -y
fi

Expand Down
13 changes: 9 additions & 4 deletions buildscripts/build_macos_mcstas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export MCVERSION=${1}

# This is an app bundle being built, but non-relocatable.
export MCINSTALL_PREFIX=/Applications/McStas-${MCVERSION}.app/
./mkdist mcstas-app ${MCVERSION} support/MacOSX/McCode.app/ "" mac-silicon "" -- OSXapp
./mkdist mcstas-app ${MCVERSION} support/MacOSX/McCode.app/ "" mac "" -- OSXapp

# For the actual mcstas part, the packages need a 'deep' PREFIX
export MCINSTALL_PREFIX=/Applications/McStas-${MCVERSION}.app/Contents/Resources
Expand All @@ -29,10 +29,15 @@ echo "* Downloading python dependencies to embedded miniconda *"
echo "*********************************************************"
echo

conda env create -p ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3 --file environment.yml
if [ -e Miniforge3-$(uname)-$(uname -m).sh ]; then
rm -f Miniforge3-$(uname)-$(uname -m).sh
fi
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
chmod a+x Miniforge3-$(uname)-$(uname -m).sh
./Miniforge3-$(uname)-$(uname -m).sh -p ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3/ -b
eval "$(${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3/bin/conda shell.bash hook)"

eval "$(conda shell.bash hook)"
conda activate ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3
CONDA_NO_PLUGINS=true mamba env update --name base --file environment.yml

cd $WORK

Expand Down
13 changes: 9 additions & 4 deletions buildscripts/build_macos_mcstas_m1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export MCINSTALL_PREFIX=/Applications/McStas-${MCVERSION}.app/

# For the actual mcstas part, the packages need a 'deep' PREFIX
export MCINSTALL_PREFIX=/Applications/McStas-${MCVERSION}.app/Contents/Resources
# 64-bit Mac OS
# 64-bit mac-silicon OS
WORK=`pwd`


Expand All @@ -29,10 +29,15 @@ echo "* Downloading python dependencies to embedded miniconda *"
echo "*********************************************************"
echo

conda env create -p ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3 --file environment.yml
if [ -e Miniforge3-$(uname)-$(uname -m).sh ]; then
rm -f Miniforge3-$(uname)-$(uname -m).sh
fi
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
chmod a+x Miniforge3-$(uname)-$(uname -m).sh
./Miniforge3-$(uname)-$(uname -m).sh -p ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3/ -b
eval "$(${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3/bin/conda shell.bash hook)"

eval "$(conda shell.bash hook)"
conda activate ${MCINSTALL_PREFIX}/mcstas/${MCVERSION}/miniconda3
CONDA_NO_PLUGINS=true mamba env update --name base --file environment.yml

cd $WORK

Expand Down
36 changes: 16 additions & 20 deletions buildscripts/build_macos_mcxtrace
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ echo "*********************************************************"
echo "* Downloading python dependencies to embedded miniconda *"
echo "*********************************************************"
echo
conda env create -p ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3 --file environment.yml

eval "$(conda shell.bash hook)"
conda activate ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3

# Temporary workaround for issue with conda...
if [ ! -f ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3/lib/librhash.0.dylib ]; then
ln -sf ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3/lib/librhash.1.dylib ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3/lib/librhash.0.dylib
if [ -e Miniforge3-$(uname)-$(uname -m).sh ]; then
rm -f Miniforge3-$(uname)-$(uname -m).sh
fi
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
chmod a+x Miniforge3-$(uname)-$(uname -m).sh
./Miniforge3-$(uname)-$(uname -m).sh -p ${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3/ -b
eval "$(${MCINSTALL_PREFIX}/mcxtrace/${MCVERSION}/miniconda3/bin/conda shell.bash hook)"

CONDA_NO_PLUGINS=true mamba env update --name base --file environment.yml

cd $WORK

Expand All @@ -46,25 +47,20 @@ cd $WORK
./mkdist mcxtrace-tools-matlab-mxdisplay ${MCVERSION} tools/matlab/mcdisplay/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-pyqtgraph ${MCVERSION} tools/Python/mcplot/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-matplotlib ${MCVERSION} tools/Python/mcplot/matplotlib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-svg ${MCVERSION} tools/Python/mcplot/svg/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxrun ${MCVERSION} tools/Python/mcrun/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdoc ${MCVERSION} tools/Python/mcdoc/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxgui ${MCVERSION} tools/Python/mcgui/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mcodelib ${MCVERSION} tools/Python/mccodelib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mctest ${MCVERSION} tools/Python/mctest/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mcresplot ${MCVERSION} tools/Python/mcresplot/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mcgui ${MCVERSION} tools/Python/mcgui/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mccodelib ${MCVERSION} tools/Python/mccodelib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-webgl ${MCVERSION} tools/Python/mcdisplay/webgl/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-pyqtgraph ${MCVERSION} tools/Python/mcdisplay/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-matplotlib ${MCVERSION} tools/Python/mcdisplay/matplotlib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-cad ${MCVERSION} tools/Python/mcdisplay/cad/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdoc ${MCVERSION} tools/Python/mcdoc/ "" mac "" -- OSXapp
./mkdist mcxtrace-clusterscripts ${MCVERSION} tools/cluster-scripts/ "" mac "" -- OSXapp
./mkdist mcxtrace-manuals ${MCVERSION} docpkg/manuals/mcxtrace/ "" mac "" -- OSXapp

cd 3rdparty/nexus-code
if [ -d build ]; then
rm -rf build
fi
mkdir -p build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/Applications/McXtrace-${MCVERSION}.app/Contents/Resources/mcxtrace/${MCVERSION}/ -DHDF5_ROOT=/Applications/McXtrace-${MCVERSION}.app/Contents/Resources/mcxtrace/${MCVERSION}/miniconda3/ -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH=/Applications/McXtrace-${MCVERSION}.app/Contents/Resources/mcxtrace/${MCVERSION}/lib ..
make install
cd $WORK

sed -i.bak s+GETPATH\(+GETPATH\(miniconda3/+g /Applications/McXtrace-${MCVERSION}.app/Contents/Resources/mcxtrace/${MCVERSION}/samples/Fluorescence.comp

# Copy in the mpicc snippets
cp support/MacOSX/mpicc-wrappers/* $MCINSTALL_PREFIX/mcxtrace/${MCVERSION}/bin
Expand Down
Loading

0 comments on commit 6ba8cf5

Please sign in to comment.