Skip to content

Commit 9481796

Browse files
committed
Try to fix Ubuntu MPI hang
1 parent f9be218 commit 9481796

5 files changed

Lines changed: 52 additions & 15 deletions

File tree

.github/workflows/test-framework.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Test AMUSE framework
33
on:
44
push:
55
branches:
6-
- main
6+
- issue-1144-new-continuous-integration
77
pull_request:
88
branches:
9-
- main
9+
- main
1010
workflow_dispatch:
1111

1212
jobs:
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
os:
2020
- ubuntu-latest
21-
- macos-latest
21+
# - macos-latest
2222

2323
defaults:
2424
run:
@@ -41,15 +41,27 @@ jobs:
4141
run: |
4242
conda install c-compiler cxx-compiler fortran-compiler 'gfortran<14' python pkgconfig coreutils patch curl tar unzip gzip bzip2 xz perl bison make cmake openmpi gsl fftw gmp mpfr hdf5 netcdf4 libopenblas liblapack zlib pip wheel 'docutils>=0.6' 'mpi4py>=1.1.0' 'numpy>=1.2.2' 'h5py>=1.1.0' pytest
4343
44-
# - name: Configure OpenMPI
45-
# run: |
46-
# mkdir -p "$HOME/.openmpi"
47-
# echo "rmaps_base_oversubscribe = true" >>"$HOME/.openmpi/mca-params.conf"
48-
# echo "mpi_yield_when_idle = true" >>"$HOME/.openmpi/mca-params.conf"
49-
# echo "btl_tcp_if_include = lo,eth0" >>"$HOME/.openmpi/mca-params.conf"
50-
# mkdir -p "$HOME/.prte"
51-
# echo "rmaps_default_mapping_policy = :oversubscribe" >>"$HOME/.prte/mca-params.conf"
52-
# echo "prte_if_include = lo,eth0" >>"$HOME/.prte/mca-params.conf"
44+
- name: Configure OpenMPI
45+
if: ${{ matrix.os == 'ubuntu-latest' }}
46+
run: |
47+
mkdir -p "$HOME/.openmpi"
48+
# echo "rmaps_base_oversubscribe = true" >>"$HOME/.openmpi/mca-params.conf"
49+
echo "mpi_yield_when_idle = true" >>"$HOME/.openmpi/mca-params.conf"
50+
echo "mca_base_verbose = stdout,level:9" >> "$HOME/.openmpi/mca-params.conf"
51+
echo "mpi_comm_verbose = 100" >> "$HOME/.openmpi/mca-params.conf"
52+
echo "btl_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf"
53+
echo "hwloc_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf"
54+
echo "if_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf"
55+
echo "pmix_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf"
56+
# echo "btl_tcp_if_include = lo,eth0" >>"$HOME/.openmpi/mca-params.conf"
57+
mkdir -p "$HOME/.prte"
58+
echo "rmaps_default_mapping_policy = :oversubscribe" >>"$HOME/.prte/mca-params.conf"
59+
echo "prte_if_include = lo,eth0" >>"$HOME/.prte/mca-params.conf"
60+
61+
- name: Test OpenMPI
62+
run: |
63+
mpicc -o mpi_test mpi_test.c
64+
mpirun -n 1 mpi_test
5365
5466
- name: Checkout
5567
uses: actions/checkout@v4
@@ -75,10 +87,12 @@ jobs:
7587
./setup test amuse-framework
7688
7789
- name: Save build logs
90+
if: always()
7891
run: |
7992
tar czf logs-${{ matrix.os }}.tar.gz support/logs
8093
8194
- name: Archive build logs
95+
if: always()
8296
uses: actions/upload-artifact@v4
8397
with:
8498
name: logs-${{ matrix.os }}.tar.gz

mpi_test.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <mpi.h>
2+
#include <stdio.h>
3+
4+
int main(int argc, char **argv) {
5+
int rank, size;
6+
7+
MPI_Init(&argc, &argv);
8+
9+
MPI_Comm_size(MPI_COMM_WORLD, &size);
10+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
11+
12+
printf("%d of %d\n", size, rank);
13+
14+
MPI_Finalize();
15+
return 0;
16+
}
17+

src/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ artifacts = ["amuse/_version.py"]
5555
pythonpath = ["tests/"]
5656
testpaths = ["tests/"]
5757

58+
addopts = "-vv -s -x -k TestAsync"
59+

src/tests/compile_tests/async_implementation/test_async.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def setup_class(cls):
4040
cls.exefile = str(Path(__file__).parent / 'async_worker')
4141

4242
def test1(self):
43-
instance = ForTestingInterface(self.exefile)
43+
instance = ForTestingInterface(
44+
self.exefile, redirection="file",
45+
redirect_stdout_file="async.out", redirect_stderr_file="async.err")
4446
int_out, error = instance.echo_int(10)
4547
instance.stop()
4648
self.assertEqual(int_out, 10)

support/setup/testing.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ test_framework() {
4747
${GMAKE} -C src/tests all
4848
# Tests for amuse.distributed won't be fixed as it is to be removed, disabled.
4949
if [ "x${CI}" = "x" ] ; then
50-
cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed' ${PYTEST_OPTS}
50+
# cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed' ${PYTEST_OPTS}
51+
cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'TestAsync and test1' ${PYTEST_OPTS}
5152
else
52-
cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed and not noci' ${PYTEST_OPTS}
53+
# cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed and not noci' ${PYTEST_OPTS}
54+
cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'TestAsync and test1 and not noci' ${PYTEST_OPTS}
5355

5456
fi
5557

0 commit comments

Comments
 (0)