|
| 1 | +name: NEURON NVHPC CI |
| 2 | + |
| 3 | + |
| 4 | +concurrency: |
| 5 | + # 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 |
| 6 | + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | + |
| 10 | +# NOTE: if using a self-hosted runner, NEVER add a `on: workflow_call` entry. |
| 11 | +# The reason is that anyone could then run the workflow on our self-hosted |
| 12 | +# machine, which is a security concern and would consume our resources. |
| 13 | +on: |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - master |
| 17 | + - release/** |
| 18 | + |
| 19 | + pull_request: |
| 20 | + branches: |
| 21 | + - master |
| 22 | + - release/** |
| 23 | + |
| 24 | + workflow_dispatch: |
| 25 | + inputs: |
| 26 | + branch: |
| 27 | + description: "Name of the NEURON branch to test" |
| 28 | + type: string |
| 29 | + required: true |
| 30 | + |
| 31 | + |
| 32 | +env: |
| 33 | + NRN_BUILD_DIR: ${{ github.workspace }}/build |
| 34 | + |
| 35 | + |
| 36 | +jobs: |
| 37 | + nvhpc: |
| 38 | + name: "Run NVHPC CI on custom runner" |
| 39 | + runs-on: "self-hosted" |
| 40 | + timeout-minutes: 60 |
| 41 | + steps: |
| 42 | + - name: "Verify NVHPC is available" |
| 43 | + env: |
| 44 | + # set this to the path (in the container!) where NVHPC makes |
| 45 | + # its executables available |
| 46 | + NVHPC_PATH: "/opt/nvidia/hpc_sdk/Linux_x86_64/25.3/compilers/bin/" |
| 47 | + run: | |
| 48 | + if [[ ! -d "${NVHPC_PATH}" ]]; then |
| 49 | + echo "ERROR: path ${NVHPC_PATH} does not exist, please verify it exists" |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | + echo "${NVHPC_PATH}" >> $GITHUB_PATH |
| 53 | +
|
| 54 | + - name: "Checkout repo" |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + ref: ${{ inputs.branch || github.sha || 'master' }} |
| 58 | + fetch-depth: 1 |
| 59 | + submodules: recursive |
| 60 | + |
| 61 | + - name: "Install Python dependencies" |
| 62 | + env: |
| 63 | + # use a cache to speed things up |
| 64 | + PYTHON_CACHE: /opt/cache/python |
| 65 | + run: | |
| 66 | + PY_EXECUTABLE="${PY_EXECUTABLE:-$(command -v python3)}" |
| 67 | + PY_MAJOR="$("${PY_EXECUTABLE}" -c 'import sys;print(sys.version_info[0])')" |
| 68 | + PY_MINOR="$("${PY_EXECUTABLE}" -c 'import sys;print(sys.version_info[1])')" |
| 69 | + VENV_DIR="venv_${PY_MAJOR}.${PY_MINOR}" |
| 70 | + "${PY_EXECUTABLE}" -m venv "${VENV_DIR}" |
| 71 | + source "${VENV_DIR}/bin/activate" |
| 72 | + python -m pip install -r ci/uv_requirements.txt |
| 73 | + uv pip install -r ci/requirements.txt --cache-dir ${PYTHON_CACHE} |
| 74 | + echo "VENV_DIR=${VENV_DIR}" >> $GITHUB_ENV |
| 75 | +
|
| 76 | + - name: "Configure NEURON" |
| 77 | + env: |
| 78 | + NRN_INSTALL_DIR: /tmp/nrn-install |
| 79 | + run: | |
| 80 | + rm -fr ${NRN_INSTALL_DIR} |
| 81 | + source "${VENV_DIR}/bin/activate" |
| 82 | + export NRN_CONFIG=(-DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_MPI=ON -DCORENRN_ENABLE_GPU=ON -DCMAKE_CXX_COMPILER=nvc++ -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_RX3D=OFF -DNRN_ENABLE_DOCS=OFF -DNRN_ENABLE_TESTS=ON -DCMAKE_C_COMPILER=nvc -DCMAKE_CUDA_COMPILER=nvcc -DCMAKE_INSTALL_PREFIX="${NRN_INSTALL_DIR}" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DNMODL_ENABLE_FLEX_BISON_LINES=OFF -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -G Ninja -DCMAKE_BUILD_TYPE=Debug) |
| 83 | + cmake -B ${NRN_BUILD_DIR} "${NRN_CONFIG[@]}" |
| 84 | +
|
| 85 | + - name: "Build NEURON" |
| 86 | + env: |
| 87 | + # use ccache to speed things up |
| 88 | + CCACHE_DIR: /opt/cache/ccache |
| 89 | + # set this to how many CPUs are available |
| 90 | + CMAKE_BUILD_PARALLEL_LEVEL: 20 |
| 91 | + run: | |
| 92 | + source "${VENV_DIR}/bin/activate" |
| 93 | + # display some ccache stats |
| 94 | + ccache -z |
| 95 | + ccache -svv |
| 96 | + cmake --build ${NRN_BUILD_DIR} |
| 97 | + ccache -svv |
| 98 | +
|
| 99 | + - name: "Test NEURON" |
| 100 | + env: |
| 101 | + # set this to how many CPUs are available |
| 102 | + CTEST_PARALLEL_LEVEL: 20 |
| 103 | + run: | |
| 104 | + source "${VENV_DIR}/bin/activate" |
| 105 | + ctest --output-on-failure --test-dir ${NRN_BUILD_DIR} |
| 106 | +
|
| 107 | + - name: "Install NEURON" |
| 108 | + run: | |
| 109 | + source "${VENV_DIR}/bin/activate" |
| 110 | + cmake --install ${NRN_BUILD_DIR} |
| 111 | +
|
| 112 | + - name: "Upload build artifacts" |
| 113 | + if: always() |
| 114 | + uses: actions/upload-artifact@v4 |
| 115 | + with: |
| 116 | + name: build_files |
| 117 | + path: | |
| 118 | + ${{ github.workspace }}/build/CMakeCache.txt |
| 119 | + ${{ github.workspace }}/build/build.ninja |
| 120 | + ${{ github.workspace }}/build/cmake_install.cmake |
| 121 | + ${{ github.workspace }}/build/install_manifest.txt |
0 commit comments