diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 98d80ceb0..331824207 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -328,7 +328,7 @@ jobs: # f = h5py.File('parallel_test.hdf5', 'w', driver='mpio', comm=MPI.COMM_WORLD) # print(f)" - - name: Install project + - name: Install project without mpi run: | python -m pip install ".[test]" --no-cache-dir python -m pip freeze @@ -362,15 +362,20 @@ jobs: run: | python -m pytest -n auto --pyargs psydac -m "not parallel and not petsc" - - name: Run MPI tests with Pytest + - name: Run single-process PETSc tests with Pytest working-directory: ./pytest run: | - python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and not petsc" + python -m pytest -n auto --pyargs psydac -m "not parallel and petsc" - - name: Run single-process PETSc tests with Pytest + - name: Install project with mpi + run: | + python -m pip install ".[mpi]" + python -m pip freeze + + - name: Run MPI tests with Pytest working-directory: ./pytest run: | - python -m pytest -n auto --pyargs psydac -m "not parallel and petsc" + python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and not petsc" - name: Run MPI PETSc tests with Pytest working-directory: ./pytest @@ -381,6 +386,7 @@ jobs: if: always() run: | rm -rf pytest + test_struphy: runs-on: ${{ matrix.os }} strategy: @@ -469,7 +475,7 @@ jobs: run: | python -m pip install --upgrade pip - - name: Install project + - name: Install project without mpi run: | python -m pip install ".[test]" --no-cache-dir python -m pip freeze @@ -479,16 +485,17 @@ jobs: echo "PSYDAC_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "STRUPHY_DIR=$GITHUB_WORKSPACE/struphy" >> $GITHUB_ENV - - name: Clone struphy from GitLab #TODO: Set branch to devel + - name: Clone struphy from GitLab run: | git clone https://gitlab.mpcdf.mpg.de/struphy/struphy.git $STRUPHY_DIR - - name: Install struphy + - name: Install struphy without mpi #TODO: Set branch to devel working-directory: ${{ env.STRUPHY_DIR }} run: | echo "Psydac location for this branch" pip show psydac pip uninstall psydac -y + git checkout 467-no-mpi python -m pip install ".[phys]" --no-cache-dir echo "Psydac location after installing struphy" pip show psydac @@ -520,6 +527,16 @@ jobs: run: | struphy test models --fast + - name: Install mpi4py + working-directory: ${{ env.STRUPHY_DIR }} + run: | + pip install -U mpi4py + + - name: Run struphy unit tests with mpi + working-directory: ${{ env.STRUPHY_DIR }} + run: | + struphy test unit --mpi 2 + - name: Remove test directory if: always() run: | diff --git a/mpi_tester.py b/mpi_tester.py index ca3dba1ae..e7f718a69 100644 --- a/mpi_tester.py +++ b/mpi_tester.py @@ -101,7 +101,8 @@ def MPITest(commsize): def test_stuff(comm): pass """ - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI + if not isinstance(commsize, (tuple, list)): commsize = (commsize,) @@ -182,7 +183,7 @@ def __init__(self): #--------------------------------------------------------------------------- @property def comm(self): - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI return MPI.COMM_WORLD #--------------------------------------------------------------------------- diff --git a/psydac/ddm/blocking_data_exchanger.py b/psydac/ddm/blocking_data_exchanger.py index ca83b140a..0a8c4759a 100644 --- a/psydac/ddm/blocking_data_exchanger.py +++ b/psydac/ddm/blocking_data_exchanger.py @@ -1,7 +1,7 @@ # coding: utf-8 import numpy as np -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI from .cart import CartDecomposition, find_mpi_type from .basic import CartDataExchanger diff --git a/psydac/ddm/cart.py b/psydac/ddm/cart.py index 56251b22c..229f4fb0d 100644 --- a/psydac/ddm/cart.py +++ b/psydac/ddm/cart.py @@ -3,8 +3,9 @@ import os import numpy as np from itertools import product -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI +from psydac.ddm.mpi import MockMPI from psydac.ddm.partition import compute_dims, partition_procs_per_patch @@ -31,11 +32,14 @@ def find_mpi_type( dtype ): MPI datatype to be used for communication. """ - if isinstance( dtype, MPI.Datatype ): - mpi_type = dtype + if not isinstance(MPI, MockMPI): + if isinstance( dtype, MPI.Datatype ): + mpi_type = dtype + else: + nt = np.dtype( dtype ) + mpi_type = MPI._typedict[nt.char] else: - nt = np.dtype( dtype ) - mpi_type = MPI._typedict[nt.char] + mpi_type = np.dtype( dtype ) return mpi_type @@ -63,7 +67,8 @@ class MultiPatchDomainDecomposition: def __init__(self, ncells, periods, comm=None, num_threads=None): assert len( ncells ) == len( periods ) - if comm is not None:assert isinstance( comm, MPI.Comm ) + if not isinstance(MPI, MockMPI) and comm is not None: + assert isinstance( comm, MPI.Comm ) num_threads = num_threads if num_threads else int(os.environ.get('OMP_NUM_THREADS', 1)) # Store input arguments @@ -206,7 +211,12 @@ def __init__(self, ncells, periods, comm=None, global_comm=None, num_threads=Non assert len( ncells ) == len( periods ) assert all( n >=1 for n in ncells ) assert all( isinstance( period, bool ) for period in periods ) - if comm is not None: assert isinstance( comm, MPI.Comm ) + if isinstance(MPI, MockMPI): + comm = None + else: + if comm is not None: + assert isinstance( comm, MPI.Comm ) + self._ncells = tuple ( ncells ) self._periods = tuple ( periods ) diff --git a/psydac/ddm/interface_data_exchanger.py b/psydac/ddm/interface_data_exchanger.py index cd60d8792..ef3a209c8 100644 --- a/psydac/ddm/interface_data_exchanger.py +++ b/psydac/ddm/interface_data_exchanger.py @@ -1,6 +1,6 @@ # coding: utf-8 -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI from .cart import InterfaceCartDecomposition, find_mpi_type diff --git a/psydac/ddm/mpi.py b/psydac/ddm/mpi.py new file mode 100644 index 000000000..40f29ef06 --- /dev/null +++ b/psydac/ddm/mpi.py @@ -0,0 +1,100 @@ +from dataclasses import dataclass +from time import time +from typing import TYPE_CHECKING + + +# Might not be needed +class MPICommWrapper: + def __init__(self, use_mpi=True): + self.use_mpi = use_mpi + if use_mpi: + from mpi4py import MPI + + self.comm = MPI.COMM_WORLD + else: + self.comm = MockComm() + + def __getattr__(self, name): + return getattr(self.comm, name) + + +class MockComm: + def __getattr__(self, name): + # Return a function that does nothing and returns None + def dummy(*args, **kwargs): + return None + + return dummy + + # Override some functions + def Get_rank(self): + return 0 + + def Get_size(self): + return 1 + + def Barrier(self): + return + + +class MPIwrapper: + def __init__(self, use_mpi: bool = False): + self.use_mpi = use_mpi + if use_mpi: + from mpi4py import MPI + + self._MPI = MPI + print("MPI is enabled") + else: + self._MPI = MockMPI() + print("MPI is NOT enabled") + + @property + def MPI(self): + return self._MPI + + +class MockMPI: + def __getattr__(self, name): + # Return a function that does nothing and returns None + def dummy(*args, **kwargs): + return None + + return dummy + + # Override some functions + @property + def COMM_WORLD(self): + return MockComm() + + # def comm_Get_rank(self): + # return 0 + + # def comm_Get_size(self): + # return 1 + + +try: + from mpi4py import MPI + + _comm = MPI.COMM_WORLD + rank = _comm.Get_rank() + size = _comm.Get_size() + mpi_enabled = True +except ImportError: + # mpi4py not installed + mpi_enabled = False +except Exception: + # mpi4py installed but not running under mpirun + mpi_enabled = False + +# TODO: add environment variable for mpi use +mpi_wrapper = MPIwrapper(use_mpi=mpi_enabled) + +# TYPE_CHECKING is True when type checking (e.g., mypy), but False at runtime. +if TYPE_CHECKING: + from mpi4py import MPI + + mpi = MPI +else: + mpi = mpi_wrapper.MPI \ No newline at end of file diff --git a/psydac/ddm/nonblocking_data_exchanger.py b/psydac/ddm/nonblocking_data_exchanger.py index 4c482518d..ecfc15730 100644 --- a/psydac/ddm/nonblocking_data_exchanger.py +++ b/psydac/ddm/nonblocking_data_exchanger.py @@ -2,8 +2,8 @@ import numpy as np from itertools import product -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI from .cart import CartDecomposition, find_mpi_type from .basic import CartDataExchanger diff --git a/psydac/ddm/tests/test_cart_1d.py b/psydac/ddm/tests/test_cart_1d.py index b3e51d3ad..ea5446da2 100644 --- a/psydac/ddm/tests/test_cart_1d.py +++ b/psydac/ddm/tests/test_cart_1d.py @@ -11,7 +11,7 @@ def run_cart_1d( data_exchanger_type, verbose=False ): import numpy as np - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI from psydac.ddm.cart import DomainDecomposition, CartDecomposition #--------------------------------------------------------------------------- diff --git a/psydac/ddm/tests/test_cart_2d.py b/psydac/ddm/tests/test_cart_2d.py index 5974a50a9..3f21af8ad 100644 --- a/psydac/ddm/tests/test_cart_2d.py +++ b/psydac/ddm/tests/test_cart_2d.py @@ -9,7 +9,7 @@ def run_cart_2d( data_exchanger_type, verbose=False , nprocs=None, reverse_axis=None): import numpy as np - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI from psydac.ddm.cart import DomainDecomposition, CartDecomposition #--------------------------------------------------------------------------- diff --git a/psydac/ddm/tests/test_cart_3d.py b/psydac/ddm/tests/test_cart_3d.py index 20b6326f4..7f86a32f2 100644 --- a/psydac/ddm/tests/test_cart_3d.py +++ b/psydac/ddm/tests/test_cart_3d.py @@ -9,7 +9,7 @@ def run_cart_3d( data_exchanger_type, verbose=False ): import numpy as np - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI from psydac.ddm.cart import DomainDecomposition, CartDecomposition #--------------------------------------------------------------------------- diff --git a/psydac/ddm/tests/test_multicart_2d.py b/psydac/ddm/tests/test_multicart_2d.py index 4b1bbddb3..4d8f57917 100644 --- a/psydac/ddm/tests/test_multicart_2d.py +++ b/psydac/ddm/tests/test_multicart_2d.py @@ -36,7 +36,8 @@ def get_plus_starts_ends(minus_starts, minus_ends, minus_npts, plus_npts, minus_ #=============================================================================== def run_carts_2d(): import numpy as np - from mpi4py import MPI + + from psydac.ddm.mpi import mpi as MPI from psydac.ddm.cart import MultiPatchDomainDecomposition, CartDecomposition, create_interfaces_cart from psydac.ddm.blocking_data_exchanger import BlockingCartDataExchanger from psydac.ddm.interface_data_exchanger import InterfaceCartDataExchanger diff --git a/psydac/fem/partitioning.py b/psydac/fem/partitioning.py index 33b3e90a3..de3a3acaf 100644 --- a/psydac/fem/partitioning.py +++ b/psydac/fem/partitioning.py @@ -2,7 +2,6 @@ import os import numpy as np -from mpi4py import MPI from psydac.ddm.cart import CartDecomposition, InterfaceCartDecomposition, create_interfaces_cart from psydac.core.bsplines import elements_spans diff --git a/psydac/fem/tensor.py b/psydac/fem/tensor.py index 39736af1f..70f849c69 100644 --- a/psydac/fem/tensor.py +++ b/psydac/fem/tensor.py @@ -5,7 +5,8 @@ of compact support """ -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI + import numpy as np import itertools import h5py diff --git a/psydac/fem/tests/test_spline_interpolation.py b/psydac/fem/tests/test_spline_interpolation.py index 6e27d60ca..b572e45b8 100644 --- a/psydac/fem/tests/test_spline_interpolation.py +++ b/psydac/fem/tests/test_spline_interpolation.py @@ -1,7 +1,8 @@ # coding: utf-8 # Copyright 2018 Yaman Güçlü -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI + import numpy as np import pytest import time diff --git a/psydac/fem/tests/test_splines_par.py b/psydac/fem/tests/test_splines_par.py index c1dae5afe..081d26074 100644 --- a/psydac/fem/tests/test_splines_par.py +++ b/psydac/fem/tests/test_splines_par.py @@ -7,9 +7,9 @@ from psydac.fem.tensor import TensorFemSpace from psydac.fem.vector import VectorFemSpace from psydac.ddm.cart import DomainDecomposition +from psydac.ddm.mpi import mpi as MPI from numpy import linspace -from mpi4py import MPI def test_2d_1(): diff --git a/psydac/linalg/block.py b/psydac/linalg/block.py index b9fdc7d4b..7db84a9f4 100644 --- a/psydac/linalg/block.py +++ b/psydac/linalg/block.py @@ -1064,7 +1064,7 @@ def compute_interface_matrices_transpose(self): if not self.codomain.parallel: return blocks, blocks_T - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI from psydac.linalg.stencil import StencilInterfaceMatrix if not isinstance(self.codomain, BlockVectorSpace): diff --git a/psydac/linalg/stencil.py b/psydac/linalg/stencil.py index 4c62139fc..85b03c4e4 100644 --- a/psydac/linalg/stencil.py +++ b/psydac/linalg/stencil.py @@ -9,8 +9,8 @@ from types import MappingProxyType from scipy.sparse import coo_matrix, diags as sp_diags -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI from psydac.linalg.basic import VectorSpace, Vector, LinearOperator from psydac.ddm.cart import find_mpi_type, CartDecomposition, InterfaceCartDecomposition from psydac.ddm.utilities import get_data_exchanger diff --git a/psydac/linalg/tests/test_block.py b/psydac/linalg/tests/test_block.py index cf887da29..00badb580 100644 --- a/psydac/linalg/tests/test_block.py +++ b/psydac/linalg/tests/test_block.py @@ -5,6 +5,7 @@ from scipy.sparse import csr_matrix from random import random, seed +from psydac.ddm.mpi import mpi as MPI from psydac.linalg.direct_solvers import SparseSolver from psydac.linalg.stencil import StencilVectorSpace, StencilVector, StencilMatrix from psydac.linalg.block import BlockVectorSpace, BlockVector @@ -999,8 +1000,6 @@ def test_block_linear_operator_parallel_dot( dtype, n1, n2, p1, p2, P1, P2 ): # set seed for reproducibility seed(n1*n2*p1*p2) - from mpi4py import MPI - comm = MPI.COMM_WORLD D = DomainDecomposition([n1,n2], periods=[P1,P2], comm=comm) @@ -1130,7 +1129,6 @@ def test_block_linear_operator_parallel_dot( dtype, n1, n2, p1, p2, P1, P2 ): def test_block_vector_2d_parallel_array_to_psydac(dtype, n1, n2, p1, p2, s1, s2, P1, P2): npts = [n1, n2] - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -1221,7 +1219,6 @@ def test_block_vector_2d_parallel_topetsc( dtype, n1, n2, p1, p2, P1, P2 ): # set seed for reproducibility seed(n1*n2*p1*p2) - from mpi4py import MPI comm = MPI.COMM_WORLD D = DomainDecomposition([n1,n2], periods=[P1,P2], comm=comm) @@ -1269,7 +1266,6 @@ def test_block_vector_2d_parallel_topetsc( dtype, n1, n2, p1, p2, P1, P2 ): def test_block_linear_operator_1d_parallel_topetsc( dtype, n1, p1, P1): # set seed for reproducibility seed(n1*p1) - from mpi4py import MPI D = DomainDecomposition([n1], periods=[P1], comm=MPI.COMM_WORLD) @@ -1343,7 +1339,6 @@ def test_block_linear_operator_1d_parallel_topetsc( dtype, n1, p1, P1): def test_block_linear_operator_2d_parallel_topetsc( dtype, n1, n2, p1, p2, P1, P2): # set seed for reproducibility seed(n1*n2*p1*p2) - from mpi4py import MPI comm = MPI.COMM_WORLD D = DomainDecomposition([n1,n2], periods=[P1,P2], comm=comm) @@ -1427,9 +1422,7 @@ def test_block_matrix_operator_parallel_dot_backend( dtype, n1, n2, p1, p2, P1, else: factor = 1 # set seed for reproducibility - - from mpi4py import MPI - + comm = MPI.COMM_WORLD D = DomainDecomposition([n1,n2], periods=[P1,P2], comm=comm) diff --git a/psydac/linalg/tests/test_fft.py b/psydac/linalg/tests/test_fft.py index a9bcef459..014ce95eb 100644 --- a/psydac/linalg/tests/test_fft.py +++ b/psydac/linalg/tests/test_fft.py @@ -1,8 +1,8 @@ import pytest import scipy.fft as scifft import numpy as np -from mpi4py import MPI +from psydac.ddm.mpi import mpi as MPI from psydac.linalg.fft import * from psydac.ddm.cart import DomainDecomposition, CartDecomposition from psydac.linalg.stencil import StencilVector diff --git a/psydac/linalg/tests/test_stencil_interface_matrix.py b/psydac/linalg/tests/test_stencil_interface_matrix.py index 60693952c..b0fa74f08 100644 --- a/psydac/linalg/tests/test_stencil_interface_matrix.py +++ b/psydac/linalg/tests/test_stencil_interface_matrix.py @@ -226,7 +226,7 @@ def test_stencil_interface_matrix_3d_serial_init(dtype, n1, n2, n3, p1, p2, p3, @pytest.mark.parallel def test_stencil_interface_matrix_2d_parallel_dot(n1, n2, p1, p2, expected): - from mpi4py import MPI + from psydac.ddm.mpi import mpi as MPI from psydac.ddm.cart import MultiPatchDomainDecomposition, CartDecomposition, create_interfaces_cart from psydac.linalg.block import BlockVectorSpace, BlockVector, BlockLinearOperator diff --git a/psydac/linalg/tests/test_stencil_vector.py b/psydac/linalg/tests/test_stencil_vector.py index 0983edf80..3b95419bd 100644 --- a/psydac/linalg/tests/test_stencil_vector.py +++ b/psydac/linalg/tests/test_stencil_vector.py @@ -3,6 +3,7 @@ import pytest import numpy as np +from psydac.ddm.mpi import mpi as MPI from psydac.linalg.stencil import StencilVectorSpace, StencilVector, StencilMatrix from psydac.linalg.utilities import array_to_psydac, petsc_to_psydac from psydac.ddm.cart import DomainDecomposition, CartDecomposition @@ -528,7 +529,6 @@ def test_stencil_vector_2d_serial_update_ghost_region_interior(dtype, n1, n2, p1 @pytest.mark.parallel def test_stencil_vector_1d_parallel_init(dtype, n1, p1, s1, P1=True): - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -564,7 +564,6 @@ def test_stencil_vector_1d_parallel_init(dtype, n1, p1, s1, P1=True): @pytest.mark.parallel def test_stencil_vector_2d_parallel_init(dtype, n1, n2, p1, p2, s1, s2, P1=True, P2=False): - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -602,7 +601,7 @@ def test_stencil_vector_2d_parallel_init(dtype, n1, n2, p1, p2, s1, s2, P1=True, @pytest.mark.parallel @pytest.mark.petsc def test_stencil_vector_2d_parallel_topetsc(dtype, n1, n2, p1, p2, s1, s2, P1, P2): - from mpi4py import MPI + comm = MPI.COMM_WORLD # Create domain decomposition @@ -645,7 +644,7 @@ def test_stencil_vector_2d_parallel_topetsc(dtype, n1, n2, p1, p2, s1, s2, P1, P @pytest.mark.parallel @pytest.mark.petsc def test_stencil_vector_1d_parallel_topetsc(dtype, n1, p1, s1, P1): - from mpi4py import MPI + comm = MPI.COMM_WORLD # Create domain decomposition @@ -696,7 +695,7 @@ def test_stencil_vector_1d_parallel_topetsc(dtype, n1, p1, s1, P1): @pytest.mark.parallel @pytest.mark.petsc def test_stencil_vector_3d_parallel_topetsc(dtype, n1, n2, n3, p1, p2, p3, s1, s2, s3, P1, P2, P3): - from mpi4py import MPI + comm = MPI.COMM_WORLD # Create domain decomposition @@ -746,7 +745,6 @@ def test_stencil_vector_3d_parallel_topetsc(dtype, n1, n2, n3, p1, p2, p3, s1, s @pytest.mark.parallel def test_stencil_vector_3d_parallel_init(dtype, n1, n2, n3, p1, p2, p3, s1, s2, s3, P1=True, P2=False, P3=True): - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -783,8 +781,6 @@ def test_stencil_vector_3d_parallel_init(dtype, n1, n2, n3, p1, p2, p3, s1, s2, @pytest.mark.parallel def test_stencil_vector_2d_parallel_toarray(dtype, n1, n2, p1, p2, s1, s2, P1=True, P2=False): # Create domain decomposition - from mpi4py import MPI - comm = MPI.COMM_WORLD D = DomainDecomposition([n1, n2], periods=[P1, P2], comm=comm) @@ -853,7 +849,6 @@ def test_stencil_vector_2d_parallel_toarray(dtype, n1, n2, p1, p2, s1, s2, P1=Tr def test_stencil_vector_2d_parallel_array_to_psydac(dtype, n1, n2, p1, p2, s1, s2, P1, P2): npts = [n1, n2] - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -909,7 +904,6 @@ def test_stencil_vector_2d_parallel_array_to_psydac(dtype, n1, n2, p1, p2, s1, s @pytest.mark.parametrize('s2', [1]) @pytest.mark.parallel def test_stencil_vector_2d_parallel_dot(dtype, n1, n2, p1, p2, s1, s2, P1=True, P2=False): - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition @@ -977,7 +971,6 @@ def test_stencil_vector_2d_parallel_dot(dtype, n1, n2, p1, p2, s1, s2, P1=True, @pytest.mark.parametrize('s3', [1]) @pytest.mark.parallel def test_stencil_vector_3d_parallel_dot(dtype, n1, n2, n3, p1, p2, p3, s1, s2, s3, P1=True, P2=False, P3=True): - from mpi4py import MPI comm = MPI.COMM_WORLD # Create domain decomposition diff --git a/psydac/linalg/tests/test_stencil_vector_space.py b/psydac/linalg/tests/test_stencil_vector_space.py index 2ef09b26e..7ada7ca50 100644 --- a/psydac/linalg/tests/test_stencil_vector_space.py +++ b/psydac/linalg/tests/test_stencil_vector_space.py @@ -1,6 +1,7 @@ import pytest import numpy as np +from psydac.ddm.mpi import mpi as MPI from psydac.linalg.stencil import StencilVectorSpace, StencilVector from psydac.ddm.cart import DomainDecomposition, CartDecomposition, find_mpi_type @@ -279,8 +280,6 @@ def test_stencil_vector_space_2D_serial_set_interface(dtype, n1, n2, p1, p2, s1, def test_stencil_vector_space_1d_parallel_init(dtype, n1, p1, s1, P1): - from mpi4py import MPI - comm = MPI.COMM_WORLD # Create domain decomposition D = DomainDecomposition([n1], periods=[P1], comm=comm) @@ -326,8 +325,6 @@ def test_stencil_vector_space_1d_parallel_init(dtype, n1, p1, s1, P1): def test_stencil_vector_space_2d_parallel_init(dtype, n1, n2, p1, p2, s1, s2, P1, P2): - from mpi4py import MPI - comm = MPI.COMM_WORLD # Create domain decomposition D = DomainDecomposition([n1, n2], periods=[P1, P2], comm=comm) @@ -373,8 +370,6 @@ def test_stencil_vector_space_2d_parallel_init(dtype, n1, n2, p1, p2, s1, s2, P1 def test_stencil_vector_space_3d_parallel_init(dtype, n1, n2, n3, p1, p2, p3, s1, s2, s3, P1=True, P2=False, P3=True): - from mpi4py import MPI - comm = MPI.COMM_WORLD # Create domain decomposition D = DomainDecomposition([n1, n2, n3], periods=[P1, P2, P3], comm=comm) @@ -413,8 +408,6 @@ def test_stencil_vector_space_3d_parallel_init(dtype, n1, n2, n3, p1, p2, p3, s1 def test_stencil_vector_space_2D_parallel_parent(dtype, n1, n2, P1=True, P2=False): - from mpi4py import MPI - comm = MPI.COMM_WORLD # Create domain decomposition D = DomainDecomposition([n1, n2], periods=[P1, P2], comm=comm) diff --git a/pyproject.toml b/pyproject.toml index 3e45a3bde..e7717ce09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "psydac" -version = "2.4.5.dev0" +version = "2.5.0.dev0" description = "Python package for isogeometric analysis (IGA)" readme = "README.md" requires-python = ">= 3.10" @@ -31,7 +31,6 @@ dependencies = [ # Our packages from PyPi 'pyccel >= 2.0.1', - 'mpi4py >= 4', 'h5py', # When pyccel is run in parallel with MPI, it uses tblib to pickle @@ -45,6 +44,9 @@ test = [ 'pytest >= 4.5', 'pytest-xdist >= 1.16', ] +mpi = [ + 'mpi4py >= 4', +] [project.urls] Homepage = "https://github.com/pyccel/psydac"