Skip to content

Commit 7cc22ce

Browse files
authored
Merge pull request #3257 from nest/add-boostless-ci-build
Add more minimal CI test
2 parents c50b841 + 53b33a9 commit 7cc22ce

File tree

7 files changed

+111
-40
lines changed

7 files changed

+111
-40
lines changed

.github/workflows/nestbuildmatrix.yml

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,9 @@ jobs:
579579
cpp_compiler: ["gcc"]
580580

581581
# available use flags (all default to "OFF"):
582-
# openmp, mpi, python, gsl, ltdl, boost, sionlib, libneurosim, optimize, warning, userdoc, music
582+
# openmp, mpi, python, gsl, ltdl, boost, sionlib, libneurosim, optimize, warning, userdoc, music, readline
583583
use:
584+
- "optimize, warning"
584585
- "boost, optimize, warning"
585586
- "openmp, python, gsl, ltdl, boost, optimize, warning"
586587
- "mpi, python, gsl, ltdl, boost, optimize, warning"
@@ -619,26 +620,41 @@ jobs:
619620
620621
- name: "Install Linux system dependencies"
621622
run: |
622-
sudo apt-get update
623623
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
624-
sudo apt-get install ccache
625-
sudo apt-get install libltdl-dev libreadline6-dev libncurses5-dev libgsl0-dev python3-all-dev jq libpcre3 libpcre3-dev
626-
sudo apt-get install tcl8.6 tcl8.6-dev tk8.6-dev
627-
# Install MPI dependencies regardless of whether we compile NEST with or without MPI, so the installation of MPI4Py works
628-
sudo apt-get install openmpi-bin libopenmpi-dev
629-
sudo apt-get install libboost-filesystem-dev libboost-regex-dev libboost-wave-dev libboost-python-dev libboost-program-options-dev libboost-test-dev
630-
sudo apt-get install pkg-config
624+
sudo apt-get update
625+
sudo apt-get install \
626+
ccache \
627+
python3-all-dev \
628+
jq \
629+
libpcre3 libpcre3-dev \
630+
pkg-config
631+
# not sure why these would be required:
632+
# sudo apt-get install tcl8.6 tcl8.6-dev tk8.6-dev
631633
sudo ldconfig
632634
635+
- name: "Install Readline dependencies"
636+
if: "${{ contains(matrix.use, 'readline') }}"
637+
run: "sudo apt-get install libreadline6-dev libncurses5-dev"
638+
639+
- name: "Install LTDL dependencies"
640+
if: "${{ contains(matrix.use, 'ltdl') }}"
641+
run: "sudo apt-get install libltdl-dev"
642+
643+
- name: "Install Boost dependencies"
644+
if: "${{ contains(matrix.use, 'boost') }}"
645+
run: "sudo apt-get install libboost-filesystem-dev libboost-regex-dev libboost-wave-dev libboost-python-dev libboost-program-options-dev libboost-test-dev"
646+
647+
- name: "Install OpenMPI development dependencies"
648+
if: "${{ contains(matrix.use, 'mpi') }}"
649+
run: "sudo apt-get install openmpi-bin libopenmpi-dev"
650+
633651
- name: "Install GSL system dependencies"
634652
if: "${{ contains(matrix.use, 'gsl') }}"
635-
run: |
636-
sudo apt-get install libgsl0-dev
653+
run: "sudo apt-get install libgsl0-dev"
637654

638655
- name: "Install HDF5 system dependencies"
639656
if: "${{ contains(matrix.use, 'hdf5') }}"
640-
run: |
641-
sudo apt-get install libhdf5-dev
657+
run: "sudo apt-get install libhdf5-dev"
642658

643659
- name: "Restore ccache"
644660
# Using CCache to re-use compiled objects from prior runs that have the same
@@ -674,13 +690,24 @@ jobs:
674690
- name: "Install Python dependencies"
675691
run: |
676692
python -m pip install --upgrade pip setuptools
693+
python -m pip install --force-reinstall --upgrade cython # this finds a broken preinstall if not explicitly forced
677694
python -c "import setuptools; print('package location:', setuptools.__file__)"
678-
python -m pip install --force-reinstall --upgrade scipy 'junitparser>=2' numpy pytest pytest-timeout pytest-xdist cython matplotlib terminaltables pandoc pandas
679-
# Install mpi4py regardless of whether we compile NEST with or without MPI, so regressiontests/issue-1703.py will run in both cases
680-
python -m pip install --force-reinstall --upgrade mpi4py
695+
pip list
696+
697+
- name: "Install Python test dependencies"
698+
# These could go to a separate venv…
699+
run: |
700+
python -m pip install 'junitparser>=2' pytest pytest-timeout pytest-xdist terminaltables
701+
python -m pip install numpy scipy pandas matplotlib
681702
test \! -e "=2" # assert junitparser is correctly quoted and '>' is not interpreted as shell redirect
682703
python -c "import pytest; print('package location:', pytest.__file__)"
683-
pip list
704+
705+
- name: "Install Python doc dependencies"
706+
run: "python -m pip install pandoc"
707+
708+
- name: "Install Python mpi dependencies"
709+
if: "${{ contains(matrix.use, 'mpi') }}"
710+
run: "python -m pip install --force-reinstall --upgrade mpi4py"
684711

685712
- name: "Install h5py"
686713
if: "${{ contains(matrix.use, 'hdf5') }}"
@@ -706,6 +733,26 @@ jobs:
706733
PYLIB_DIR="$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))" | sed 's/include/lib/')"
707734
./build_support/install_csa-libneurosim.sh $PYLIB_DIR
708735
736+
- name: "Uninstall Boost development libraries"
737+
if: "${{ ! contains(matrix.use, 'boost') }}"
738+
run: |
739+
apt list --installed 'libboost*'
740+
sudo apt-get remove --autoremove 'libboost*-dev'
741+
742+
- name: "List available packages"
743+
if: "${{ ! contains(matrix.use, 'boost') }}"
744+
run: |
745+
gcc --version
746+
python --version
747+
echo "INSTALLED PYTHON PACKAGES:"
748+
pip list
749+
echo "INSTALLED BOOST PACKAGES:"
750+
dpkg -l 'libboost*' | grep "^ii" || true
751+
echo "INSTALLED BOOST HEADERS:"
752+
dpkg -l 'libboost*-dev' | grep "^ii" || true
753+
echo "LIST HAS TO BE ZERO"
754+
test -z "$(dpkg -l 'libboost*-dev' | grep "^ii")"
755+
709756
- name: "Configure NEST build"
710757
env:
711758
CMAKE_C_COMPILER_LAUNCHER: ccache

testsuite/pytests/conftest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,15 @@ def have_plotting():
159159

160160
@pytest.fixture(scope="session")
161161
def subprocess_compatible_mpi():
162-
"""Until at least OpenMPI 4.1.6, the following fails due to a bug in OpenMPI, from 5.0.7 is definitely safe."""
163-
164-
res = subprocess.run(["mpirun", "-np", "1", "echo"])
165-
return res.returncode == 0
162+
"""
163+
Until at least OpenMPI 4.1.6, the following fails due to a bug in OpenMPI,
164+
from 5.0.7 is definitely safe.
165+
"""
166+
try:
167+
res = subprocess.run(["mpirun", "-np", "1", "echo"])
168+
return 0 == res.returncode
169+
except FileNotFoundError:
170+
return False
166171

167172

168173
@pytest.fixture(autouse=True)

testsuite/pytests/connect_test_base.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@
2525
import numpy as np
2626
import scipy.stats
2727

28+
# Check that NEST is installed with MPI support and mpi4py is available.
2829
try:
29-
from mpi4py import MPI
30+
import mpi4py
3031

31-
haveMPI4Py = True
32+
HAVE_MPI4PY = nest.ll_api.sli_func("statusdict/have_mpi ::")
3233
except ImportError:
33-
haveMPI4Py = False
34+
HAVE_MPI4PY = False
35+
36+
if HAVE_MPI4PY:
37+
from mpi4py import MPI
3438

3539

3640
class ConnectTestBase(unittest.TestCase):
@@ -309,7 +313,7 @@ def gather_data(data_array):
309313
None otherwise.
310314
311315
"""
312-
if haveMPI4Py:
316+
if HAVE_MPI4PY:
313317
data_array_list = MPI.COMM_WORLD.gather(data_array, root=0)
314318
if MPI.COMM_WORLD.Get_rank() == 0:
315319
if isinstance(data_array, list):
@@ -327,7 +331,7 @@ def bcast_data(data):
327331
"""
328332
Broadcasts data from the root MPI node to all other nodes.
329333
"""
330-
if haveMPI4Py:
334+
if HAVE_MPI4PY:
331335
data = MPI.COMM_WORLD.bcast(data, root=0)
332336
return data
333337

@@ -340,7 +344,7 @@ def is_array(data):
340344

341345

342346
def mpi_barrier():
343-
if haveMPI4Py:
347+
if HAVE_MPI4PY:
344348
MPI.COMM_WORLD.Barrier()
345349

346350

testsuite/pytests/test_connect_all_to_all.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
import numpy as np
2828
import scipy.stats
2929

30+
HAVE_MPI = nest.ll_api.sli_func("statusdict/have_mpi ::")
3031
HAVE_OPENMP = nest.ll_api.sli_func("is_threaded")
3132

3233

34+
@unittest.skipIf(not HAVE_MPI, "NEST was compiled without MPI")
3335
@unittest.skipIf(not HAVE_OPENMP, "NEST was compiled without multi-threading")
3436
@nest.ll_api.check_stack
3537
class TestAllToAll(connect_test_base.ConnectTestBase):

testsuite/pytests/test_connect_tripartite_bernoulli.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@
2525
import pytest
2626
import scipy.stats
2727

28+
# Check that NEST is installed with MPI support and mpi4py is available.
2829
try:
29-
from mpi4py import MPI
30+
import mpi4py
3031

31-
haveMPI4Py = True
32+
HAVE_MPI4PY = nest.ll_api.sli_func("statusdict/have_mpi ::")
3233
except ImportError:
33-
haveMPI4Py = False
34+
HAVE_MPI4PY = False
35+
36+
if HAVE_MPI4PY:
37+
from mpi4py import MPI
3438

3539

3640
def setup_network(
@@ -209,7 +213,7 @@ def gather_data(data_array):
209213
available, the original array is returned.
210214
211215
"""
212-
if haveMPI4Py:
216+
if HAVE_MPI4PY:
213217
data_array_list = MPI.COMM_WORLD.gather(data_array, root=0)
214218
if MPI.COMM_WORLD.Get_rank() == 0:
215219
if isinstance(data_array, list):
@@ -263,7 +267,7 @@ def chi_squared_check(degrees, expected):
263267

264268
def mpi_barrier():
265269
"""Forms a barrier for MPI processes until all of them call the function."""
266-
if haveMPI4Py:
270+
if HAVE_MPI4PY:
267271
MPI.COMM_WORLD.Barrier()
268272

269273

testsuite/pytests/test_sp/test_disconnect.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@
2323

2424
import nest
2525

26+
# Check that NEST is installed with MPI support and mpi4py is available.
2627
try:
27-
from mpi4py import MPI
28+
import mpi4py
2829

29-
have_mpi4py = True
30+
HAVE_MPI4PY = nest.ll_api.sli_func("statusdict/have_mpi ::")
3031
except ImportError:
31-
have_mpi4py = False
32+
HAVE_MPI4PY = False
33+
34+
if HAVE_MPI4PY:
35+
from mpi4py import MPI
3236

33-
have_mpi = nest.ll_api.sli_func("statusdict/have_mpi ::")
34-
test_with_mpi = have_mpi and have_mpi4py and nest.num_processes > 1
37+
test_with_mpi = HAVE_MPI4PY and nest.num_processes > 1
3538

3639

3740
class TestDisconnectSingle(unittest.TestCase):

testsuite/regressiontests/issue-1703.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import subprocess
3232
import sys
3333

34+
import nest
35+
3436
EXIT_CODE_SUCCESS = 0
3537
EXIT_CODE_ERROR = 1
3638
EXIT_CODE_SEGFAULT = -11
@@ -40,12 +42,16 @@
4042
EXIT_FAILURE = 127
4143
EXIT_SEGFAULT = 139
4244

43-
# Check that NEST is installed with Python support, and that mpi4py is available.
45+
# Check that NEST is installed with MPI support and mpi4py is available.
4446
# If not, the test is skipped.
4547
try:
46-
import nest
47-
from mpi4py import MPI # noqa: F401
48+
import mpi4py
49+
50+
HAVE_MPI4PY = nest.ll_api.sli_func("statusdict/have_mpi ::")
4851
except ImportError:
52+
HAVE_MPI4PY = False
53+
54+
if not HAVE_MPI4PY:
4955
sys.exit(EXIT_SKIPPED)
5056

5157
# Attempt to import MPI from mpi4py before NEST. Running the script in a separate process,

0 commit comments

Comments
 (0)