Skip to content

neuronapi: add nrn_sectionlist_to_array for batched section-list acce… #11321

neuronapi: add nrn_sectionlist_to_array for batched section-list acce…

neuronapi: add nrn_sectionlist_to_array for batched section-list acce… #11321

Workflow file for this run

name: NEURON Code Coverage
concurrency:
# Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }}
cancel-in-progress: true
on:
merge_group:
push:
branches:
- master
- release/**
pull_request:
branches:
- master
- release/**
# TODO : https://github.com/neuronsimulator/nrn/issues/1063
# paths-ignore:
# - '**.md'
# - '**.rst'
# - 'docs/**'
env:
PY_MIN_VERSION: '3.10'
PY_MID_VERSION: '3.11'
PY_MAX_VERSION: '3.14'
# The Linux runners have 4 cores:
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
CMAKE_BUILD_PARALLEL_LEVEL: '4'
CTEST_PARALLEL_LEVEL: '4'
CCACHE_DIR: ${{ github.workspace }}/ccache
jobs:
coverage:
runs-on: ubuntu-22.04
name: Code Coverage
timeout-minutes: 60
env:
DISPLAY: ${{ ':0' }}
MUSIC_INSTALL_DIR: /opt/MUSIC
# hash of commit containing mpi4py 4 fix
MUSIC_VERSION: '13f312338dcccebfe74d391b1b24f1b6d816ac6c'
steps:
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y xfonts-100dpi build-essential doxygen lcov libboost-all-dev libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin gpg ninja-build flex bison libfl-dev libdw-dev binutils-dev
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
- name: Install a new ccache
run: |
# versions older than 4.10 do not support -fprofile-update=atomic
wget 'https://github.com/ccache/ccache/releases/download/v4.11.3/ccache-4.11.3-linux-x86_64.tar.xz'
tar xf ccache-4.11.3-linux-x86_64.tar.xz
sudo cp -a ccache-4.11.3-linux-x86_64/ccache /usr/bin/ccache
working-directory: ${{runner.temp}}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version : '3.20'
- name: Setup Caliper profiler
run: |
git clone --branch v2.12.1 --depth 1 --recurse-submodules --shallow-submodules https://github.com/LLNL/Caliper.git
cd Caliper
cmake -B build -G Ninja .
sudo cmake --build build --target install
working-directory: ${{runner.temp}}
- name: Setup Xvfb
run: |
sudo apt-get install xvfb
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1600x1200x24 -noreset -nolock -shmem & # run in bg
- uses: actions/checkout@v4
with:
fetch-depth: 2
# Restore (and later save) dependencies for min version of Python
- name: Restore Python@${{ env.PY_MIN_VERSION }} dependencies
id: cache-python-min-packages-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/pip_cache${{ env.PY_MIN_VERSION }}
key: cache-${{ env.PY_MIN_VERSION }}-${{ hashFiles('ci/requirements.txt') }}
- name: Set up Python@${{ env.PY_MIN_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_MIN_VERSION }}
- name: Install Python@${{ env.PY_MIN_VERSION }} dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install -r ci/uv_requirements.txt
python -m uv pip install -r ci/requirements.txt --cache-dir ${{ github.workspace }}/pip_cache${{ env.PY_MIN_VERSION }}
- name: Save Python@${{ env.PY_MIN_VERSION }} dependencies
id: cache-python-min-packages-save
if: always() && steps.cache-python-min-packages-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-python-min-packages-restore.outputs.cache-primary-key }}
path: ${{ github.workspace }}/pip_cache${{ env.PY_MIN_VERSION }}
# Restore (and later save) dependencies for mid version of Python
- name: Restore Python@${{ env.PY_MID_VERSION }} dependencies
id: cache-python-mid-packages-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/pip_cache${{ env.PY_MID_VERSION }}
key: cache-${{ env.PY_MID_VERSION }}-${{ hashFiles('ci/requirements.txt') }}
- name: Set up Python@${{ env.PY_MID_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_MID_VERSION }}
- name: Install Python@${{ env.PY_MID_VERSION }} dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install -r ci/uv_requirements.txt
python -m uv pip install -r ci/requirements.txt --cache-dir ${{ github.workspace }}/pip_cache${{ env.PY_MID_VERSION }}
- name: Save Python@${{ env.PY_MID_VERSION }} dependencies
id: cache-python-mid-packages-save
if: always() && steps.cache-python-mid-packages-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-python-mid-packages-restore.outputs.cache-primary-key }}
path: ${{ github.workspace }}/pip_cache${{ env.PY_MID_VERSION }}
# Restore (and later save) dependencies for max version of Python
- name: Restore Python@${{ env.PY_MAX_VERSION }} dependencies
id: cache-python-max-packages-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/pip_cache${{ env.PY_MAX_VERSION }}
key: cache-${{ env.PY_MAX_VERSION }}-${{ hashFiles('ci/requirements.txt') }}
- name: Set up Python@${{ env.PY_MAX_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_MAX_VERSION }}
- name: Install Python@${{ env.PY_MAX_VERSION }} dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install -r ci/uv_requirements.txt
python -m uv pip install -r ci/requirements.txt --cache-dir ${{ github.workspace }}/pip_cache${{ env.PY_MAX_VERSION }}
- name: Save Python@${{ env.PY_MAX_VERSION }} dependencies
id: cache-python-max-packages-save
if: always() && steps.cache-python-max-packages-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-python-max-packages-restore.outputs.cache-primary-key }}
path: ${{ github.workspace }}/pip_cache${{ env.PY_MAX_VERSION }}
- name: Setup MUSIC@${{ env.MUSIC_VERSION }}
run: |
python -m venv music-venv
source music-venv/bin/activate
python -m pip install -r ${{ github.workspace }}/ci/uv_requirements.txt
python -m uv pip install -r ${{ github.workspace }}/ci/requirements.txt --cache-dir ${{ github.workspace }}/pip_cache${{ env.PY_MAX_VERSION }}
sudo mkdir -p $MUSIC_INSTALL_DIR
sudo chown -R $USER $MUSIC_INSTALL_DIR
curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/${MUSIC_VERSION}.zip
unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC
./autogen.sh
./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource
make -j install
deactivate
working-directory: ${{runner.temp}}
# Restore (and later save) ccache
- name: Restore compiler cache
id: restore-compiler-cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/ccache
key: ccache-coverage-${{runner.os}}-${{github.ref_name}}
restore-keys: |
ccache-coverage-${{runner.os}}-master
- name: Build & Test
id: build-test
shell: bash
working-directory: ${{runner.workspace}}/nrn
run: |
export SHELL="/bin/bash"
# Compiler setup
export CC=gcc
export CXX=g++
# Python setup
export PYTHON_MIN=$(which $PYTHON_MIN_NAME);
export PYTHON_MID=$(which $PYTHON_MID_NAME);
export PYTHON_MAX=$(which $PYTHON_MAX_NAME);
# Update all submodules with depth 1
git submodule update --init --recursive --depth 1
mkdir build && cd build;
# CMake options & flags
cmake_args=(-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DNRN_ENABLE_BACKTRACE=ON \
-DNRN_ENABLE_CORENEURON=ON \
-DNRN_ENABLE_COVERAGE=ON \
-DNRN_ENABLE_INTERVIEWS=ON \
-DNRN_ENABLE_MPI=ON \
-DNRN_ENABLE_PERFORMANCE_TESTS=OFF \
-DNRN_ENABLE_PROFILING=ON \
-DNRN_ENABLE_PYTHON=ON \
-DNRN_ENABLE_PYTHON_DYNAMIC=ON \
-DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \
-DNRN_PYTHON_EXTRA_FOR_TESTS=${PYTHON_MID} \
-DNRN_ENABLE_TESTS=ON \
-DNRN_ENABLE_MUSIC=ON \
-DCMAKE_PREFIX_PATH="${MUSIC_INSTALL_DIR}" \
-DMUSIC_ROOT="${MUSIC_INSTALL_DIR}")
cmake .. "${cmake_args[@]}"
# Coverage
ccache -z
ccache -s -v || ccache -s
cmake --build .
ccache -s -v || ccache -s
cmake --build . --target cover_baseline
xvfb-run ctest --rerun-failed --output-on-failure
for python in "${PYTHON_MIN}" "${PYTHON_MAX}"
do
echo "Using ${python}"
NEURONHOME="${PWD}/share/nrn" \
PYTHONPATH="${PWD}/lib/python:${PYTHONPATH}" \
PATH="${PWD}/bin:${PATH}" \
LD_LIBRARY_PATH="${PWD}/lib:${LD_LIBRARY_PATH}" \
DYLD_LIBRARY_PATH="${PWD}/lib:${DYLD_LIBRARY_PATH}" \
"${python}" -c "from neuron import h; import neuron; neuron.test();neuron.test_rxd(); from neuron.tests import test_nmodl; test_nmodl.test_nmodl()"
done
cmake --build . --target cover_collect
cmake --build . --target cover_combine
env:
MATRIX_EVAL: "CC=gcc CXX=g++"
PYTHON_MIN_NAME: "python${{ env.PY_MIN_VERSION }}"
PYTHON_MID_NAME: "python${{ env.PY_MID_VERSION }}"
PYTHON_MAX_NAME: "python${{ env.PY_MAX_VERSION }}"
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-${{runner.os}}
path: |
${{runner.workspace}}/nrn/build/CMakeCache.txt
${{runner.workspace}}/nrn/build/build.ninja
${{runner.workspace}}/nrn/build/cmake_install.cmake
- name: Save compiler cache
id: save-compiler-cache
if: always() && steps.restore-compiler-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.restore-compiler-cache.outputs.cache-primary-key }}
path: ${{ github.workspace }}/ccache
# This step will set up an SSH connection on tmate.io for live debugging.
# To enable it, you have to:
# * add 'live-debug-coverage' to your PR title
# * push something to your PR branch (note that just re-running the pipeline disregards the title update)
- name: live debug session on failure (manual steps required, check `.github/coverage.yml`)
if: failure() && contains(github.event.pull_request.title, 'live-debug-coverage')
uses: mxschmitt/action-tmate@v3
- uses: codecov/codecov-action@v4
with:
directory: ./build
fail_ci_if_error: true
verbose: true
# token: ${{ contains(github.head_ref, 'dependabot/') && secrets.CODECOV_TOKEN || '' }}
token: ${{ secrets.CODECOV_TOKEN }}