Skip to content

Fixed a MPI bug with MultiCompartmentReaction which produce membrane … #32

Fixed a MPI bug with MultiCompartmentReaction which produce membrane …

Fixed a MPI bug with MultiCompartmentReaction which produce membrane … #32

Workflow file for this run

name: Template for building NEURON Python wheels

Check failure on line 1 in .github/workflows/wheels-template.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/wheels-template.yml

Invalid workflow file

(Line: 145, Col: 13): Unexpected symbol: '"ubuntu"'. Located at position 29 within expression: startsWith(inputs.platform, "ubuntu"), (Line: 151, Col: 13): Unexpected symbol: '"macOS"'. Located at position 23 within expression: startsWith(runner.os, "macOS")
on:
workflow_call:
inputs:
platform:
description: The platform (OS) for which to build the wheel
required: true
type: string
python_version:
description: The Python version for which to build the wheel
required: true
type: string
commit:
description: The commit of NEURON for which to build the wheel
required: true
type: string
version:
description: Override version (tag name), in format major.minor.patch
default: ''
type: string
build_type:
description: The type of build (release or nightly)
default: 'nightly'
type: string
clone_depth:
description: The depth to clone the repo
default: '1'
type: string
optimize_rxd:
description: Whether to optimize the RX3D Python module
default: false
type: boolean
jobs:
build-test:
name: Build and test Python ${{ inputs.python_version }} wheel on ${{ inputs.platform }}
runs-on: ${{ inputs.platform }}
timeout-minutes: 60
steps:
- name: Check out code at branch/commit ${{ inputs.commit }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
submodules: recursive
fetch-depth: ${{ inputs.clone_depth }}
fetch-tags: true # Ensures tags are available for git describe
- name: Install Python from python.org
if: runner.os == 'macOS'
run: |
# I would've preferred the versions to be in their own YAML file for
# readability, but alas, GitHub Actions does not support expanding
# nested expressions, so we do this the brute-force way with Bash
case "${{ inputs.python_version }}" in
3.9) version="3.9.13" ;;
3.10) version="3.10.11" ;;
3.11) version="3.11.7" ;;
3.12) version="3.12.0" ;;
3.13) version="3.13.0" ;;
3.14) version="3.14.0" ;;
*) echo "Unknown Python version"; exit 1 ;;
esac
installer_name="macos11.pkg"
installer_filename="python-${version}-${installer_name}"
url="https://www.python.org/ftp/python/${version}/${installer_filename}"
curl $url -o $installer_filename
sudo installer -pkg $installer_filename -target /
- name: Install system dependencies
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
brew uninstall cmake || echo "CMake was not pre-installed"
brew install flex bison cmake mpich ninja
brew unlink mpich && brew install openmpi
# Install newer version of Bash on MacOS
brew install bash
# For debugging
bash --version
cmake --version
# Uninstall libomp for compatibility with issue #817
brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist"
echo "$(brew --prefix)/opt/cmake/bin:$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH
- name: Install readline
if: runner.os == 'macOS'
run: |
sudo mkdir -p /opt/nrnwheel/$(uname -m)
sudo bash packaging/python/build_static_readline_osx.bash
- name: Change name of package for release
if: inputs.build_type == 'release'
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install tomli tomli-w
python3 packaging/python/change_name.py ./pyproject.toml neuron
- name: Optimize RX3D Python module
if: inputs.optimize_rxd == true
run: |
echo "NRN_RX3D_OPT_LEVEL=1" >> $GITHUB_ENV
- name: Set custom version
if: inputs.version != ''
run: |
echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Build wheel
run: |
bash packaging/python/build_wheels.bash $(uname -s) ${{ inputs.python_version }}
- name: Upload wheel files
uses: actions/upload-artifact@v4
with:
name: wheels-${{ inputs.python_version }}-${{ inputs.platform }}
path: wheelhouse/*.whl
- name: Setup Python ${{ inputs.python_version }} for testing
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: Install test dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev ninja-build
- name: "Apply workaround for MPICH on Ubuntu 24.04"
if: inputs.platform == 'ubuntu-24.04'
run: |
# mpich is fundamentally broken on Ubuntu 24.04 LTS, for more details see:
# https://bugs.launchpad.net/ubuntu/+source/mpich/+bug/2072338
# This is fixed in version 4.2.0-5.1, but this version has not been
# backported, so as a workaround, we install that version manually
sudo apt install -y mpich
wget 'https://launchpad.net/ubuntu/+source/mpich/4.2.0-5.1/+build/28285882/+files/mpich_4.2.0-5.1_amd64.deb'
wget 'https://launchpad.net/ubuntu/+source/mpich/4.2.0-5.1/+build/28285882/+files/libmpich12_4.2.0-5.1_amd64.deb'
sudo dpkg --install mpich_4.2.0-5.1_amd64.deb libmpich12_4.2.0-5.1_amd64.deb
- name: Set env vars for testing (Linux)
if: startsWith(inputs.platform, "ubuntu")
run: |
echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV
echo CMAKE_GENERATOR=Ninja >> $GITHUB_ENV
- name: Set env vars for testing (MacOS)
if: startsWith(runner.os, "macOS")
run: |
if [[ "${{runner.os}}" == "macOS-15-intel" ]]; then
echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV
else
echo CMAKE_BUILD_PARALLEL_LEVEL=3 >> $GITHUB_ENV
fi
echo CMAKE_GENERATOR=Ninja >> $GITHUB_ENV
- name: Test wheel with ${{ inputs.python_version }}
run: |
minor_version="$(python${{ inputs.python_version }} -c 'import sys;print(sys.version_info.minor)')"
bash packaging/python/test_wheels.sh $(command -v python${{ inputs.python_version }}) wheelhouse/*cp3${minor_version}*.whl