diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index acfce7e..8382040 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -89,4 +89,44 @@ jobs: docker run --rm local-test-image:latest bash -c "\ python3 -m pip install pytest scipy && \ cd /dolfinx/python/test && \ - python3 -m pytest -vs" \ No newline at end of file + python3 -m pytest -vs" + + + - name: Verify MPI ABI Swap (Stubs -> MPICH) + run: | + docker run --rm local-test-image:latest bash -c "\ + cat << 'EOF' > test_comm.cpp + #include + #include + int main(int argc, char **argv) { + MPI_Init(&argc, &argv); + int rank, size; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + std::cout << \"Hello from rank \" << rank << \" of \" << size << std::endl; + MPI_Finalize(); + return 0; + } + EOF + + echo '--- Compiling with Stubs ---' && \ + mpicxx -std=c++17 test_comm.cpp -o test_comm && \ + + echo '--- Running with Stubs ---' && \ + mpiexec -n 1 ./test_comm && \ + + echo '--- Downloading & Building MPICH with ABI support ---' && \ + MPICH_VERSION=4.3.2 && \ + wget -q https://www.mpich.org/static/downloads/\${MPICH_VERSION}/mpich-\${MPICH_VERSION}.tar.gz && \ + tar xfz mpich-\${MPICH_VERSION}.tar.gz && \ + cd mpich-\${MPICH_VERSION} && \ + ./configure --enable-mpi-abi --prefix=/opt/mpich --disable-fortran --disable-cxx --disable-romio && \ + make -j4 install && \ + cd .. && \ + + echo '--- Checking Dynamic Linking (ldd) ---' && \ + export LD_LIBRARY_PATH=/opt/mpich/lib:\$LD_LIBRARY_PATH && \ + ldd test_comm && \ + + echo '--- Running with real MPICH ---' && \ + /opt/mpich/bin/mpiexec -n 1 ./test_comm" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 607fb8b..6d9eb7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,12 @@ add_library(mpistub SHARED ${MPI_STUB_SOURCES}) # Force the output name to "mpi" to generate libmpi.so set_target_properties(mpistub PROPERTIES - OUTPUT_NAME "mpi" - VERSION "1.0.0" - SOVERSION "12" + OUTPUT_NAME "mpi_abi" + VERSION 0.0.0 + SOVERSION 0 C_STANDARD 11 C_STANDARD_REQUIRED YES + WINDOWS_EXPORT_ALL_SYMBOLS 1 ) # Setup include directories diff --git a/Dockerfile b/Dockerfile index 0c6d15b..0162c40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,7 @@ RUN python3 -m venv ${VIRTUAL_ENV} && \ pip install --no-cache-dir cython numpy==${NUMPY_VERSION} # Install mpi4py against our stub -RUN env MPICC="${STUBS_DIR}/bin/mpicc" \ +RUN env MPI4PY_BUILD_MPIABI=1 MPICC="${STUBS_DIR}/bin/mpicc" \ pip install --no-cache-dir --no-build-isolation --no-binary mpi4py mpi4py RUN python3 -c "from mpi4py import MPI; print(MPI.Get_version())" && \