diff --git a/.github/workflows/test-framework.yml b/.github/workflows/test-framework.yml index acb03c2217..ea5d830944 100644 --- a/.github/workflows/test-framework.yml +++ b/.github/workflows/test-framework.yml @@ -3,10 +3,10 @@ name: Test AMUSE framework on: push: branches: - - main + - issue-1144-new-continuous-integration pull_request: branches: - - main + - main workflow_dispatch: jobs: @@ -18,7 +18,7 @@ jobs: matrix: os: - ubuntu-latest - - macos-latest + # - macos-latest defaults: run: @@ -41,15 +41,27 @@ jobs: run: | 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 - # - name: Configure OpenMPI - # run: | - # mkdir -p "$HOME/.openmpi" - # echo "rmaps_base_oversubscribe = true" >>"$HOME/.openmpi/mca-params.conf" - # echo "mpi_yield_when_idle = true" >>"$HOME/.openmpi/mca-params.conf" - # echo "btl_tcp_if_include = lo,eth0" >>"$HOME/.openmpi/mca-params.conf" - # mkdir -p "$HOME/.prte" - # echo "rmaps_default_mapping_policy = :oversubscribe" >>"$HOME/.prte/mca-params.conf" - # echo "prte_if_include = lo,eth0" >>"$HOME/.prte/mca-params.conf" + - name: Configure OpenMPI + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + mkdir -p "$HOME/.openmpi" + # echo "rmaps_base_oversubscribe = true" >>"$HOME/.openmpi/mca-params.conf" + echo "mpi_yield_when_idle = true" >>"$HOME/.openmpi/mca-params.conf" + echo "mca_base_verbose = stdout,level:9" >> "$HOME/.openmpi/mca-params.conf" + echo "mpi_comm_verbose = 100" >> "$HOME/.openmpi/mca-params.conf" + echo "btl_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf" + echo "hwloc_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf" + echo "if_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf" + echo "pmix_base_verbose = 100" >> "$HOME/.openmpi/mca-params.conf" + # echo "btl_tcp_if_include = lo,eth0" >>"$HOME/.openmpi/mca-params.conf" + mkdir -p "$HOME/.prte" + echo "rmaps_default_mapping_policy = :oversubscribe" >>"$HOME/.prte/mca-params.conf" + echo "prte_if_include = lo,eth0" >>"$HOME/.prte/mca-params.conf" + + - name: Test OpenMPI + run: | + mpicc -o $HOME/amuse/mpi_test $HOME/amuse/mpi_test.c + mpirun -n 1 $HOME/amuse/mpi_test - name: Checkout uses: actions/checkout@v4 @@ -75,10 +87,12 @@ jobs: ./setup test amuse-framework - name: Save build logs + if: always() run: | tar czf logs-${{ matrix.os }}.tar.gz support/logs - name: Archive build logs + if: always() uses: actions/upload-artifact@v4 with: name: logs-${{ matrix.os }}.tar.gz diff --git a/mpi_test.c b/mpi_test.c new file mode 100644 index 0000000000..27275e7a97 --- /dev/null +++ b/mpi_test.c @@ -0,0 +1,17 @@ +#include +#include + +int main(int argc, char **argv) { + int rank, size; + + MPI_Init(&argc, &argv); + + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + printf("%d of %d\n", size, rank); + + MPI_Finalize(); + return 0; +} + diff --git a/src/pyproject.toml b/src/pyproject.toml index 01a36b4096..8a210356dc 100644 --- a/src/pyproject.toml +++ b/src/pyproject.toml @@ -55,3 +55,5 @@ artifacts = ["amuse/_version.py"] pythonpath = ["tests/"] testpaths = ["tests/"] +addopts = "-vv -s -x -k TestAsync" + diff --git a/src/tests/compile_tests/async_implementation/test_async.py b/src/tests/compile_tests/async_implementation/test_async.py index 204d6ceda7..d9ff58ac66 100644 --- a/src/tests/compile_tests/async_implementation/test_async.py +++ b/src/tests/compile_tests/async_implementation/test_async.py @@ -40,7 +40,9 @@ def setup_class(cls): cls.exefile = str(Path(__file__).parent / 'async_worker') def test1(self): - instance = ForTestingInterface(self.exefile) + instance = ForTestingInterface( + self.exefile, redirection="file", + redirect_stdout_file="async.out", redirect_stderr_file="async.err") int_out, error = instance.echo_int(10) instance.stop() self.assertEqual(int_out, 10) diff --git a/support/setup/testing.sh b/support/setup/testing.sh index c948145ea7..8c4ddcb254 100644 --- a/support/setup/testing.sh +++ b/support/setup/testing.sh @@ -47,9 +47,11 @@ test_framework() { ${GMAKE} -C src/tests all # Tests for amuse.distributed won't be fixed as it is to be removed, disabled. if [ "x${CI}" = "x" ] ; then - cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed' ${PYTEST_OPTS} + # cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'not TestCDistributedImplementationInterface and not TestAsyncDistributed' ${PYTEST_OPTS} + cd src/tests && pytest --import-mode=append core_tests compile_tests --ignore compile_tests/java_implementation -k 'TestAsync and test1' ${PYTEST_OPTS} else - 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} + # 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} + 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} fi