Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RXD failures on ARM #3179

Open
JCGoran opened this issue Nov 6, 2024 · 0 comments
Open

Fix RXD failures on ARM #3179

JCGoran opened this issue Nov 6, 2024 · 0 comments
Labels

Comments

@JCGoran
Copy link
Collaborator

JCGoran commented Nov 6, 2024

In #3177 we skipped some of the CVODE-related tests for RXD on ARM platforms.
To reproduce in the CI on ARM-based MacOS, here's a Github Actions file:

name: Build MacOS Wheels

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

# do not cancel so we can see results
concurrency:
  cancel-in-progress: false
  group: ${{ github.workflow }}-${{ github.ref }}

jobs:
  build-test-deploy:
    name: Build MacOS Wheels
    runs-on: ${{ matrix.os }}
    timeout-minutes: 60
    strategy:
      matrix:
        os: [macos-14]
        python-version: ['3.10']

    steps:
      - name: Check out code
        uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install OSX System Dependencies
        run: |
          brew install --cask xquartz
          brew install flex bison mpich
          brew unlink mpich && brew install openmpi
          cmake --version
          # Uninstall libomp for compatibility with issue #817
          brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist"
          brew install cmake
          echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH
          echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH

      - name: Install readline
        run: |
          sudo mkdir -p /opt/nrnwheel/$(uname -m)
          sudo bash packaging/python/build_static_readline_osx.bash

      - name: Build MacOS Wheel
        run: |
          packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron

      - name: Test wheel
        run: |
          minor_version="$(python -c 'import sys;print(sys.version_info.minor)')"
          packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl

      - name: Upload wheel files
        uses: actions/upload-artifact@v3
        with:
          name: macos-wheels-${{ matrix.python-version }}
          path: wheelhouse/*.whl

To reproduce on ARM-based Linux, since Github Actions does not support ARM-based Linux runners, one can do the following locally (I will use podman/docker commands interchangeably):

  1. install podman or docker
  2. (if not running on ARM-based MacOS) run docker run --rm --privileged docker.io/multiarch/qemu-user-static --reset -p yes to enable emulation of ARM on x86_64
  3. make clean clone of NEURON: git clone https://github.com/neuronsimulator/nrn
  4. run the following:
docker run --rm \
    -w /root/nrn \
    -v $PWD:/root/nrn \
    -e NEURON_NIGHTLY_TAG="" \
    -e NRN_NIGHTLY_UPLOAD="true" \
    -e NRN_RELEASE_UPLOAD="false" \
    -e SETUPTOOLS_SCM_PRETEND_VERSION="9.0.0" \
    --platform linux/arm64 \
    -e NRN_BUILD_FOR_UPLOAD=1 \
    'neuronsimulator/neuron_wheel:latest-gcc9-aarch64' \
    packaging/python/build_wheels.bash linux 3.10 coreneuron

This will put a NEURON wheel in the wheelhouse dir.

  1. put the following contents in a file called Dockerfile:
FROM docker.io/ubuntu:22.04
RUN apt-get update && apt-get install -y python3-venv python3-pip
# you may need to tweak the below to match the exact filename of the wheel produced in step 4
COPY wheelhouse/NEURON-9.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl .
RUN python3 -m venv env
RUN env/bin/python -m pip install NEURON*.whl
RUN env/bin/python -c 'import neuron; neuron.test_rxd()'
  1. run docker build --platform linux/arm64 -t neuron_reproducer .

In any case, the output is something like:

FAIL: test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase.test_ecs_diffusion_variable_step_coarse)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/nrn/nrn/nrn_test_venv_311/lib/python3.11/site-packages/neuron/tests/test_rxd.py", line 163, in test_ecs_diffusion_variable_step_coarse
    assert p.exitcode == 0
           ^^^^^^^^^^^^^^^
AssertionError

======================================================================
FAIL: test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase.test_ecs_diffusion_variable_step_fine)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/nrn/nrn/nrn_test_venv_311/lib/python3.11/site-packages/neuron/tests/test_rxd.py", line 170, in test_ecs_diffusion_variable_step_fine
    assert p.exitcode == 0
           ^^^^^^^^^^^^^^^
AssertionError

Error size for the two appears to be:

FAIL: test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase.test_ecs_diffusion_variable_step_coarse)
assert ecs_vec.sum() <= 1e-9, f"{ecs_vec.sum()=}"
AssertionError: ecs_vec.sum()=6.905884752939073e-09

FAIL: test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase.test_ecs_diffusion_variable_step_fine)
assert ecs_vec.sum() <= 1e-9, f"{ecs_vec.sum()=}"
AssertionError: ecs_vec.sum()=1.3189747141151287e-06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant