From 64c3ecb602965236e6c344f5b89bab4aa21784b4 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 12 Jun 2024 19:24:07 -0400 Subject: [PATCH 01/22] removed conda from ci pipeline --- .github/workflows/unit_tests.yml | 64 ++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3de966ffb..98a5a1fca 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -12,16 +12,16 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] - python-version: [3.8, 3.9] + os: [ubuntu-24.04,macos-14] + python-version: [3.8,3.9] steps: - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + id: cp310 + with: python-version: ${{ matrix.python-version }} - fetch-depth: 2 - name: Install ubuntu dependencies shell: bash -el {0} run: | @@ -30,24 +30,58 @@ jobs: sudo apt-get update sudo apt-get install libopenmpi-dev openmpi-bin fi; + - name: Install MacOs dependencies + shell: bash -el {0} + run: | + if [ "${{ matrix.os }}" == "macos-latest" ]; then + brew install open-mpi + fi; - name: Install dependencies shell: bash -el {0} run: | - python -m pip install --upgrade pip - conda install --yes -c conda-forge mpi4py openmpi + '${{ steps.cp310.outputs.python-path }}' -m pip install --upgrade pip + '${{ steps.cp310.outputs.python-path }}' -m pip install mpi4py openmpi + - name: Check MPI version + shell: bash -el {0} + run: | + mpiexec --version + - name: Check Python version + shell: bash -el {0} + run: | + '${{ steps.cp310.outputs.python-path }}' --version - name: Install HNN-core shell: bash -el {0} run: | - pip install --verbose '.[opt, parallel, test, gui]' - - name: Lint with flake8 + '${{ steps.cp310.outputs.python-path }}' -m pip install --verbose '.[opt, parallel, test, gui]' + - name: Set Env Variables shell: bash -el {0} run: | - flake8 --count hnn_core - - name: Test with pytest + if [ "${{ matrix.os }}" == "macos-latest" ]; then + echo "List /opt/homebrew/lib" + ls /opt/homebrew/lib + echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV + fi; + # - name: Run MPI application + # shell: bash -el {0} + # run: | + # mpiexec -np 2 '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py + - name: Verify NEURON installation shell: bash -el {0} run: | - python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml - - name: Upload coverage to Codecov + nrniv -python -nobanner -mpi '${{ steps.cp310.outputs.python-path }}' "from neuron import h; print(h)" + # - name: Run MPI application with NEURON + # shell: bash -el {0} + # run: | + # mpiexec -np 2 -verbose nrniv -python -mpi -nobanner '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py + # - name: Lint with flake8 + # shell: bash -el {0} + # run: | + # flake8 --count hnn_core + - name: Test with pytest shell: bash -el {0} run: | - bash <(curl -s https://codecov.io/bash) -f ./coverage.xml + '${{ steps.cp310.outputs.python-path }}' -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml + # - name: Upload coverage to Codecov + # shell: bash -el {0} + # run: | + # bash <(curl -s https://codecov.io/bash) -f ./coverage.xml From e58c42ff6d86dbfb0dbfb4d74609646f12c9ddb8 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 12 Jun 2024 19:29:47 -0400 Subject: [PATCH 02/22] MAINT: Switching to ubuntu 22.04 --- .github/workflows/unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 98a5a1fca..e3390502b 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-24.04,macos-14] + os: [ubuntu-22.04,macos-14] python-version: [3.8,3.9] steps: From 45173b2aac34fd99f693f032ac423a2680810e82 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 12 Jun 2024 19:36:56 -0400 Subject: [PATCH 03/22] MAINT: Added conditionals to install openmpi according to matrix.os --- .github/workflows/unit_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index e3390502b..b229edbdd 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -23,19 +23,19 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install ubuntu dependencies + if: contains(matrix.os, 'ubuntu') shell: bash -el {0} run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install libopenmpi-dev openmpi-bin - fi; + - name: Install MacOs dependencies + if: contains(matrix.os, 'macos') shell: bash -el {0} run: | - if [ "${{ matrix.os }}" == "macos-latest" ]; then brew install open-mpi - fi; + - name: Install dependencies shell: bash -el {0} run: | From c51d95bfd312965d6e5b409334621671ad440cc3 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 12 Jun 2024 19:44:53 -0400 Subject: [PATCH 04/22] MAINT: moving macos MPI_LIB_NRN_PATH env variable assigment --- .github/workflows/unit_tests.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index b229edbdd..d6b60d228 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -35,6 +35,8 @@ jobs: shell: bash -el {0} run: | brew install open-mpi + echo "List /opt/homebrew/lib" + echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV - name: Install dependencies shell: bash -el {0} @@ -53,14 +55,13 @@ jobs: shell: bash -el {0} run: | '${{ steps.cp310.outputs.python-path }}' -m pip install --verbose '.[opt, parallel, test, gui]' - - name: Set Env Variables - shell: bash -el {0} - run: | - if [ "${{ matrix.os }}" == "macos-latest" ]; then - echo "List /opt/homebrew/lib" - ls /opt/homebrew/lib - echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV - fi; + + # - name: Set Env Variables + # if: contains(matrix.os, 'macos') + # shell: bash -el {0} + # run: | + # echo "List /opt/homebrew/lib" + # echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV # - name: Run MPI application # shell: bash -el {0} # run: | From 8a797590d1e6cd117ad1b6d30e8ef8475f563c14 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 12 Jun 2024 20:05:39 -0400 Subject: [PATCH 05/22] MAINT: Removing comments and additional test in unit_test.yml --- .github/workflows/unit_tests.yml | 41 +++++++------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index d6b60d228..88b61d090 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -35,7 +35,6 @@ jobs: shell: bash -el {0} run: | brew install open-mpi - echo "List /opt/homebrew/lib" echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV - name: Install dependencies @@ -43,46 +42,22 @@ jobs: run: | '${{ steps.cp310.outputs.python-path }}' -m pip install --upgrade pip '${{ steps.cp310.outputs.python-path }}' -m pip install mpi4py openmpi - - name: Check MPI version - shell: bash -el {0} - run: | - mpiexec --version - - name: Check Python version - shell: bash -el {0} - run: | - '${{ steps.cp310.outputs.python-path }}' --version - name: Install HNN-core shell: bash -el {0} run: | '${{ steps.cp310.outputs.python-path }}' -m pip install --verbose '.[opt, parallel, test, gui]' - # - name: Set Env Variables - # if: contains(matrix.os, 'macos') - # shell: bash -el {0} - # run: | - # echo "List /opt/homebrew/lib" - # echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV - # - name: Run MPI application - # shell: bash -el {0} - # run: | - # mpiexec -np 2 '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py - - name: Verify NEURON installation + - name: Lint with flake8 shell: bash -el {0} run: | - nrniv -python -nobanner -mpi '${{ steps.cp310.outputs.python-path }}' "from neuron import h; print(h)" - # - name: Run MPI application with NEURON - # shell: bash -el {0} - # run: | - # mpiexec -np 2 -verbose nrniv -python -mpi -nobanner '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py - # - name: Lint with flake8 - # shell: bash -el {0} - # run: | - # flake8 --count hnn_core + flake8 --count hnn_core + - name: Test with pytest shell: bash -el {0} run: | '${{ steps.cp310.outputs.python-path }}' -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml - # - name: Upload coverage to Codecov - # shell: bash -el {0} - # run: | - # bash <(curl -s https://codecov.io/bash) -f ./coverage.xml + + - name: Upload coverage to Codecov + shell: bash -el {0} + run: | + bash <(curl -s https://codecov.io/bash) -f ./coverage.xml From 927905c9d6065aa33f26f2727379328e1e593505 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Thu, 13 Jun 2024 22:23:40 -0400 Subject: [PATCH 06/22] MAINT: Moving linux CI to a separate workflow --- .github/workflows/linux_unit_test.yml | 54 +++++++++++++++++++ .../{unit_tests.yml => macos_unit_tests.yml} | 0 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/linux_unit_test.yml rename .github/workflows/{unit_tests.yml => macos_unit_tests.yml} (100%) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml new file mode 100644 index 000000000..eda66ce25 --- /dev/null +++ b/.github/workflows/linux_unit_test.yml @@ -0,0 +1,54 @@ +name: Unit tests + +on: + push: + branches: ['**'] + pull_request: + branches: ['**'] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: [3.8,3.9] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install ubuntu dependencies + shell: bash -el {0} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install libopenmpi-dev openmpi-bin + + - name: Install dependencies + shell: bash -el {0} + run: | + python -m pip install --upgrade pip + python -m pip install mpi4py openmpi + - name: Install HNN-core + shell: bash -el {0} + run: | + python -m pip install --verbose '.[opt, parallel, test, gui]' + + - name: Lint with flake8 + shell: bash -el {0} + run: | + flake8 --count hnn_core + + - name: Test with pytest + shell: bash -el {0} + run: | + python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml + + - name: Upload coverage to Codecov + shell: bash -el {0} + run: | + bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/macos_unit_tests.yml similarity index 100% rename from .github/workflows/unit_tests.yml rename to .github/workflows/macos_unit_tests.yml From 862fb416cdd6de075810a6edae804e963135b2cc Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Thu, 13 Jun 2024 22:51:31 -0400 Subject: [PATCH 07/22] STY: fixed flake8 errors --- .github/workflows/macos_unit_tests.yml | 36 ++++++++++---------------- hnn_core/gui/gui.py | 6 ++--- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/macos_unit_tests.yml b/.github/workflows/macos_unit_tests.yml index 88b61d090..fac63e14b 100644 --- a/.github/workflows/macos_unit_tests.yml +++ b/.github/workflows/macos_unit_tests.yml @@ -12,52 +12,42 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04,macos-14] - python-version: [3.8,3.9] + os: [macos-latest] + python-version: [3.8, 3.9] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - id: cp310 - with: + - uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: test python-version: ${{ matrix.python-version }} + fetch-depth: 2 - name: Install ubuntu dependencies - if: contains(matrix.os, 'ubuntu') shell: bash -el {0} run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install libopenmpi-dev openmpi-bin - - - name: Install MacOs dependencies - if: contains(matrix.os, 'macos') - shell: bash -el {0} - run: | - brew install open-mpi - echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV - + fi; - name: Install dependencies shell: bash -el {0} run: | - '${{ steps.cp310.outputs.python-path }}' -m pip install --upgrade pip - '${{ steps.cp310.outputs.python-path }}' -m pip install mpi4py openmpi + python -m pip install --upgrade pip + conda install --yes -c conda-forge mpi4py openmpi - name: Install HNN-core shell: bash -el {0} run: | - '${{ steps.cp310.outputs.python-path }}' -m pip install --verbose '.[opt, parallel, test, gui]' - + pip install --verbose '.[opt, parallel, test, gui]' - name: Lint with flake8 shell: bash -el {0} run: | flake8 --count hnn_core - - name: Test with pytest shell: bash -el {0} run: | - '${{ steps.cp310.outputs.python-path }}' -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml - + python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml - name: Upload coverage to Codecov shell: bash -el {0} run: | - bash <(curl -s https://codecov.io/bash) -f ./coverage.xml + bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file diff --git a/hnn_core/gui/gui.py b/hnn_core/gui/gui.py index 6b01e1c06..37e6ee6a8 100644 --- a/hnn_core/gui/gui.py +++ b/hnn_core/gui/gui.py @@ -24,8 +24,7 @@ from hnn_core.gui._logging import logger from hnn_core.gui._viz_manager import _VizManager, _idx2figname from hnn_core.network import pick_connection -from hnn_core.params import (_extract_drive_specs_from_hnn_params, _read_json, - _read_legacy_params) +from hnn_core.params import (_extract_drive_specs_from_hnn_params) from hnn_core.dipole import _read_dipole_txt import base64 @@ -1275,7 +1274,8 @@ def load_drive_and_connectivity(params, log_out, drives_out, """Add drive and connectivity ipywidgets from params.""" with log_out: # Add connectivity - add_connectivity_tab(params, connectivity_out, connectivity_textfields) + add_connectivity_tab(params, connectivity_out, + connectivity_textfields) # Add drives add_drive_tab(params, log_out, drives_out, drive_widgets, drive_boxes, tstop, layout) From 0fb984e6e4e179bf2de98a18fa96594610e3cb23 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Thu, 13 Jun 2024 23:10:28 -0400 Subject: [PATCH 08/22] STY: fixed flake8 errors in gui.py --- hnn_core/gui/gui.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hnn_core/gui/gui.py b/hnn_core/gui/gui.py index 37e6ee6a8..d39093908 100644 --- a/hnn_core/gui/gui.py +++ b/hnn_core/gui/gui.py @@ -1226,7 +1226,8 @@ def add_connectivity_tab(params, connectivity_out, return net -def add_drive_tab(params, log_out, drives_out, drive_widgets, drive_boxes, tstop, +def add_drive_tab(params, log_out, drives_out, drive_widgets, + drive_boxes, tstop, layout): net = jones_2009_model(params) @@ -1275,9 +1276,10 @@ def load_drive_and_connectivity(params, log_out, drives_out, with log_out: # Add connectivity add_connectivity_tab(params, connectivity_out, - connectivity_textfields) + connectivity_textfields) # Add drives - add_drive_tab(params, log_out, drives_out, drive_widgets, drive_boxes, tstop, + add_drive_tab(params, log_out, drives_out, drive_widgets, + drive_boxes, tstop, layout) @@ -1339,7 +1341,8 @@ def on_upload_params_change(change, tstop, dt, log_out, drive_boxes, add_connectivity_tab(params, connectivity_out, connectivity_textfields) elif load_type == 'drives': with log_out: - add_drive_tab(params, log_out, drives_out, drive_widgets, drive_boxes, tstop, + add_drive_tab(params, log_out, drives_out, + drive_widgets, drive_boxes, tstop, layout) else: raise ValueError From 4c91250cc1d988442f906d587288085ad517759d Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Thu, 13 Jun 2024 23:16:47 -0400 Subject: [PATCH 09/22] MAINT: Removing linux commands from macos CI workflow --- .github/workflows/macos_unit_tests.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/macos_unit_tests.yml b/.github/workflows/macos_unit_tests.yml index fac63e14b..a693527d7 100644 --- a/.github/workflows/macos_unit_tests.yml +++ b/.github/workflows/macos_unit_tests.yml @@ -22,14 +22,6 @@ jobs: activate-environment: test python-version: ${{ matrix.python-version }} fetch-depth: 2 - - name: Install ubuntu dependencies - shell: bash -el {0} - run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install libopenmpi-dev openmpi-bin - fi; - name: Install dependencies shell: bash -el {0} run: | From 9b8ea30eb893f01be4920c976f10a12d93dafc56 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Sun, 16 Jun 2024 09:36:08 -0400 Subject: [PATCH 10/22] TST: Adding python 3.10 and 3.11 to the tests --- .github/workflows/linux_unit_test.yml | 2 +- .github/workflows/macos_unit_tests.yml | 2 +- .github/workflows/windows_unit_tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index eda66ce25..c37b2a95b 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8,3.9] + python-version: [3.8, 3.9, 3.10, 3.11] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/macos_unit_tests.yml b/.github/workflows/macos_unit_tests.yml index a693527d7..7a47f6f65 100644 --- a/.github/workflows/macos_unit_tests.yml +++ b/.github/workflows/macos_unit_tests.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [macos-latest] - python-version: [3.8, 3.9] + python-version: [3.8, 3.9, 3.10, 3.11] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index 665ed7562..b13a3569a 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [windows-latest] - python-version: [3.8, 3.9] + python-version: [3.8, 3.9, 3.10, 3.11] steps: - uses: actions/checkout@v4 From 3735a39fbcc26c10414def7d3fdee36114b22a2c Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Sun, 16 Jun 2024 09:41:58 -0400 Subject: [PATCH 11/22] TST: Adding quotes to python version 3.10 --- .github/workflows/linux_unit_test.yml | 2 +- .github/workflows/windows_unit_tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index c37b2a95b..d3236b42c 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: [3.8, 3.9, '3.10', 3.11] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index b13a3569a..ce02f6d9f 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [windows-latest] - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: [3.8, 3.9, '3.10', 3.11] steps: - uses: actions/checkout@v4 From d4a1150f710cdf070ac1f5f6d259f7e56bbb72d7 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Sun, 16 Jun 2024 09:45:41 -0400 Subject: [PATCH 12/22] TST: Adding double quotes for macos python 3.10 build --- .github/workflows/macos_unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos_unit_tests.yml b/.github/workflows/macos_unit_tests.yml index 7a47f6f65..325bcf99c 100644 --- a/.github/workflows/macos_unit_tests.yml +++ b/.github/workflows/macos_unit_tests.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [macos-latest] - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: [3.8, 3.9, "3.10", 3.11] steps: - uses: actions/checkout@v4 From 19b8d5e9a3dc1ddc2816f1c3b8afc99a8125ad3b Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 09:31:46 -0400 Subject: [PATCH 13/22] added python and mpi version verification. removing openmpi installation from pip --- .github/workflows/linux_unit_test.yml | 12 +++++++-- .github/workflows/macos_unit_tests.yml | 32 ++++++++++++------------ .github/workflows/windows_unit_tests.yml | 18 ++++++------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index d3236b42c..7fa6c098a 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -27,12 +27,20 @@ jobs: sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install libopenmpi-dev openmpi-bin - + - name: Check MPI version + shell: bash -el {0} + run: | + mpiexec --version + - name: Check Python version + shell: bash -el {0} + run: | + python --version + - name: Install dependencies shell: bash -el {0} run: | python -m pip install --upgrade pip - python -m pip install mpi4py openmpi + python -m pip install mpi4py - name: Install HNN-core shell: bash -el {0} run: | diff --git a/.github/workflows/macos_unit_tests.yml b/.github/workflows/macos_unit_tests.yml index 325bcf99c..a089c7b7a 100644 --- a/.github/workflows/macos_unit_tests.yml +++ b/.github/workflows/macos_unit_tests.yml @@ -27,19 +27,19 @@ jobs: run: | python -m pip install --upgrade pip conda install --yes -c conda-forge mpi4py openmpi - - name: Install HNN-core - shell: bash -el {0} - run: | - pip install --verbose '.[opt, parallel, test, gui]' - - name: Lint with flake8 - shell: bash -el {0} - run: | - flake8 --count hnn_core - - name: Test with pytest - shell: bash -el {0} - run: | - python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml - - name: Upload coverage to Codecov - shell: bash -el {0} - run: | - bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file + # - name: Install HNN-core + # shell: bash -el {0} + # run: | + # pip install --verbose '.[opt, parallel, test, gui]' + # - name: Lint with flake8 + # shell: bash -el {0} + # run: | + # flake8 --count hnn_core + # - name: Test with pytest + # shell: bash -el {0} + # run: | + # python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml + # - name: Upload coverage to Codecov + # shell: bash -el {0} + # run: | + # bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index ce02f6d9f..468cc706f 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -34,12 +34,12 @@ jobs: python -c "import neuron" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install dependencies and HNN - shell: cmd - run: | - python -m pip install --upgrade pip - pip install --verbose .[opt,parallel,test,gui] - - name: Test with pytest - shell: cmd - run: | - python -m pytest ./hnn_core/tests/ + # - name: Install dependencies and HNN + # shell: cmd + # run: | + # python -m pip install --upgrade pip + # pip install --verbose .[opt,parallel,test,gui] + # - name: Test with pytest + # shell: cmd + # run: | + # python -m pytest ./hnn_core/tests/ From fb5db28c1636bff073c0de158c8b43d415395278 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 09:48:20 -0400 Subject: [PATCH 14/22] removing python 3.10 and 3.11 from the test --- .github/workflows/windows_unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index 468cc706f..2ecbbc6c7 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [windows-latest] - python-version: [3.8, 3.9, '3.10', 3.11] + python-version: [3.8, 3.9] steps: - uses: actions/checkout@v4 From c84040862731cd3fe0a078a51b26a82470686b88 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 09:53:05 -0400 Subject: [PATCH 15/22] removing python 3.10 and 3.11 from the test in Linux --- .github/workflows/linux_unit_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index 7fa6c098a..35aeec2a6 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8, 3.9, '3.10', 3.11] + python-version: [3.8, 3.9] steps: - uses: actions/checkout@v4 From 6c8824aca64a6e2946cc9aff483e61831eb7909e Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:15:17 -0400 Subject: [PATCH 16/22] Only testing test_parallel_backends.py in 3.9.10 --- .github/workflows/linux_unit_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index 35aeec2a6..d03c68513 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8, 3.9] + python-version: ['3.9.10'] steps: - uses: actions/checkout@v4 @@ -54,7 +54,7 @@ jobs: - name: Test with pytest shell: bash -el {0} run: | - python -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml + python -m pytest ./hnn_core/tests/test_parallel_backends.py --cov=hnn_core --cov-report=xml - name: Upload coverage to Codecov shell: bash -el {0} From b2abdfb6488841d5a4a1754a7a98646738452b89 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:26:07 -0400 Subject: [PATCH 17/22] testing python 3.9.10 and ubuntu-20.04 --- .github/workflows/linux_unit_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index d03c68513..f70b4ff79 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-20.04] python-version: ['3.9.10'] steps: @@ -20,7 +20,7 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '>=3.9.10 <3.9.12' - name: Install ubuntu dependencies shell: bash -el {0} run: | From be91556b0108ab1304c3a206b452ce2f47872ec4 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:30:49 -0400 Subject: [PATCH 18/22] testing again only python 3.9.10 and ubuntu-20.04 --- .github/workflows/linux_unit_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index f70b4ff79..b65c104f7 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '>=3.9.10 <3.9.12' + python-version: '3.9.10' - name: Install ubuntu dependencies shell: bash -el {0} run: | From 21f0f7557846f34e3b3d9611e8e640df5a08a29e Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:38:20 -0400 Subject: [PATCH 19/22] added mpi_test.py --- .github/workflows/linux_unit_test.yml | 26 +++++++++++++++++++------- hnn_core/mpi_test.py | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 hnn_core/mpi_test.py diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index b65c104f7..18b2bd275 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -45,18 +45,30 @@ jobs: shell: bash -el {0} run: | python -m pip install --verbose '.[opt, parallel, test, gui]' - - - name: Lint with flake8 + - name: Run MPI application + shell: bash -el {0} + run: | + mpiexec -np 2 python ./hnn_core/mpi_test.py + - name: Verify NEURON installation + shell: bash -el {0} + run: | + nrniv -python -nobanner -mpi python "from neuron import h; print(h)" + - name: Run MPI application with NEURON shell: bash -el {0} run: | - flake8 --count hnn_core + mpiexec -np 2 -verbose nrniv -python -mpi -nobanner python ./hnn_core/mpi_test.py + + # - name: Lint with flake8 + # shell: bash -el {0} + # run: | + # flake8 --count hnn_core - name: Test with pytest shell: bash -el {0} run: | python -m pytest ./hnn_core/tests/test_parallel_backends.py --cov=hnn_core --cov-report=xml - - name: Upload coverage to Codecov - shell: bash -el {0} - run: | - bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file + # - name: Upload coverage to Codecov + # shell: bash -el {0} + # run: | + # bash <(curl -s https://codecov.io/bash) -f ./coverage.xml \ No newline at end of file diff --git a/hnn_core/mpi_test.py b/hnn_core/mpi_test.py new file mode 100644 index 000000000..203290732 --- /dev/null +++ b/hnn_core/mpi_test.py @@ -0,0 +1,27 @@ +from mpi4py import MPI +import logging +from neuron import h +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger() + +comm = MPI.COMM_WORLD +rank = comm.Get_rank() +size = comm.Get_size() + +logger.info(f"Process {rank} out of {size} processors") +# Initialize NEURON with MPI support +h(''' +objref pc +pc = new ParallelContext() +''') + +# Check if NEURON MPI is enabled +is_mpi_enabled = int(h.pc.nhost() > 1) + +if is_mpi_enabled: + logger.info(f"NEURON MPI is enabled. Running on {int(h.pc.nhost())} processes") +else: + logger.info("NEURON MPI is not enabled.") + +if rank == 0: + print("NEURON MPI test completed") \ No newline at end of file From cdb7bbe16d8041f7f4d318ec5a7b4fe36645c2f0 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:43:02 -0400 Subject: [PATCH 20/22] fix linux worflow file --- .github/workflows/linux_unit_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index 18b2bd275..168d6206b 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -45,9 +45,9 @@ jobs: shell: bash -el {0} run: | python -m pip install --verbose '.[opt, parallel, test, gui]' - - name: Run MPI application - shell: bash -el {0} - run: | + - name: Run MPI application + shell: bash -el {0} + run: | mpiexec -np 2 python ./hnn_core/mpi_test.py - name: Verify NEURON installation shell: bash -el {0} From 7d1464011b38da6b015e2fe798016c01afc02bd3 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 10:51:21 -0400 Subject: [PATCH 21/22] adding parameter in pytest to print in stdout --- .github/workflows/linux_unit_test.yml | 2 +- hnn_core/tests/test_parallel_backends.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index 168d6206b..d758f0bb5 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -66,7 +66,7 @@ jobs: - name: Test with pytest shell: bash -el {0} run: | - python -m pytest ./hnn_core/tests/test_parallel_backends.py --cov=hnn_core --cov-report=xml + python -m pytest ./hnn_core/tests/test_parallel_backends.py --cov=hnn_core --cov-report=xml -s # - name: Upload coverage to Codecov # shell: bash -el {0} diff --git a/hnn_core/tests/test_parallel_backends.py b/hnn_core/tests/test_parallel_backends.py index b6e9f7ed6..b51c0cfa3 100644 --- a/hnn_core/tests/test_parallel_backends.py +++ b/hnn_core/tests/test_parallel_backends.py @@ -256,7 +256,9 @@ def test_mpi_failure(run_hnn_core_fixture): assert "MPI processes are unable to reach each other" in stdout expected_string = "Child process failed unexpectedly" - assert len(record) == 1 + print(record[0].message.args[0]) assert record[0].message.args[0] == expected_string + assert len(record) == 1 + del environ["OMPI_MCA_btl"] From 541f51735f99a0f6e1bea9154cef3bcde4630b23 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Mon, 17 Jun 2024 15:30:43 -0400 Subject: [PATCH 22/22] added pip freeze and test viz --- .github/workflows/linux_unit_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_unit_test.yml b/.github/workflows/linux_unit_test.yml index d758f0bb5..ad4104246 100644 --- a/.github/workflows/linux_unit_test.yml +++ b/.github/workflows/linux_unit_test.yml @@ -62,11 +62,15 @@ jobs: # shell: bash -el {0} # run: | # flake8 --count hnn_core + - name: Freeze package versions + shell: bash -el {0} + run: | + python -m pip freeze - name: Test with pytest shell: bash -el {0} run: | - python -m pytest ./hnn_core/tests/test_parallel_backends.py --cov=hnn_core --cov-report=xml -s + python -m pytest ./hnn_core/tests/test_viz.py --cov=hnn_core --cov-report=xml -s # - name: Upload coverage to Codecov # shell: bash -el {0}