feectools 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. {feectools-0.4.0/feectools.egg-info → feectools-0.5.0}/PKG-INFO +2 -1
  2. feectools-0.5.0/feectools/__init__.py +7 -0
  3. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/blocking_data_exchanger.py +1 -2
  4. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/cart.py +5 -13
  5. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/interface_data_exchanger.py +1 -2
  6. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/nonblocking_data_exchanger.py +1 -1
  7. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_cart_1d.py +1 -1
  8. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_cart_2d.py +1 -1
  9. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_cart_3d.py +1 -1
  10. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_coarsen.py +1 -3
  11. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_multicart_2d.py +1 -1
  12. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tensor.py +1 -2
  13. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_spline_interpolation.py +1 -2
  14. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_splines_par.py +1 -2
  15. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_tensor.py +1 -1
  16. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/basic.py +1 -1
  17. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/block.py +1 -1
  18. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/stencil.py +1 -1
  19. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_block.py +1 -1
  20. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_fft.py +1 -1
  21. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_mpi_device.py +1 -1
  22. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_stencil_interface_matrix.py +1 -1
  23. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_stencil_vector.py +1 -1
  24. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_stencil_vector_space.py +1 -1
  25. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_toarray.py +1 -1
  26. {feectools-0.4.0 → feectools-0.5.0/feectools.egg-info}/PKG-INFO +2 -1
  27. {feectools-0.4.0 → feectools-0.5.0}/feectools.egg-info/SOURCES.txt +0 -1
  28. {feectools-0.4.0 → feectools-0.5.0}/feectools.egg-info/requires.txt +1 -0
  29. {feectools-0.4.0 → feectools-0.5.0}/pyproject.toml +2 -1
  30. feectools-0.4.0/feectools/__init__.py +0 -4
  31. feectools-0.4.0/feectools/ddm/mpi.py +0 -223
  32. {feectools-0.4.0 → feectools-0.5.0}/AUTHORS +0 -0
  33. {feectools-0.4.0 → feectools-0.5.0}/LICENSE +0 -0
  34. {feectools-0.4.0 → feectools-0.5.0}/README.md +0 -0
  35. {feectools-0.4.0 → feectools-0.5.0}/feectools/accelerate/__init__.py +0 -0
  36. {feectools-0.4.0 → feectools-0.5.0}/feectools/accelerate/accelerate.py +0 -0
  37. {feectools-0.4.0 → feectools-0.5.0}/feectools/accelerate/compile_psydac.mk +0 -0
  38. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/__init__.py +0 -0
  39. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/essential_bc.py +0 -0
  40. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/fem_bilinear_form.py +0 -0
  41. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/fem_common.py +0 -0
  42. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/fem_sum_form.py +0 -0
  43. {feectools-0.4.0 → feectools-0.5.0}/feectools/api/settings.py +0 -0
  44. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/__init__.py +0 -0
  45. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/bsplines.py +0 -0
  46. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/bsplines_kernels.py +0 -0
  47. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/field_evaluation_kernels.py +0 -0
  48. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/tests/__init__.py +0 -0
  49. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/tests/test_bsplines.py +0 -0
  50. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/tests/test_bsplines_kernel.py +0 -0
  51. {feectools-0.4.0 → feectools-0.5.0}/feectools/core/tests/test_bsplines_pyccel.py +0 -0
  52. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/__init__.py +0 -0
  53. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/basic.py +0 -0
  54. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/partition.py +0 -0
  55. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/petsc.py +0 -0
  56. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/__init__.py +0 -0
  57. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_device_binding.py +0 -0
  58. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/tests/test_partition.py +0 -0
  59. {feectools-0.4.0 → feectools-0.5.0}/feectools/ddm/utilities.py +0 -0
  60. {feectools-0.4.0 → feectools-0.5.0}/feectools/feec/__init__.py +0 -0
  61. {feectools-0.4.0 → feectools-0.5.0}/feectools/feec/derivatives.py +0 -0
  62. {feectools-0.4.0 → feectools-0.5.0}/feectools/feec/dof_kernels.py +0 -0
  63. {feectools-0.4.0 → feectools-0.5.0}/feectools/feec/global_geometric_projectors.py +0 -0
  64. {feectools-0.4.0 → feectools-0.5.0}/feectools/feec/hodge.py +0 -0
  65. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/__init__.py +0 -0
  66. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/basic.py +0 -0
  67. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/grid.py +0 -0
  68. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/lst_preconditioner.py +0 -0
  69. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/partitioning.py +0 -0
  70. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/projectors.py +0 -0
  71. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/splines.py +0 -0
  72. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/__init__.py +0 -0
  73. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/analytical_profiles_1d.py +0 -0
  74. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/analytical_profiles_base.py +0 -0
  75. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/splines_error_bounds.py +0 -0
  76. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_dirichlet_projectors.py +0 -0
  77. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_spline_histopolation.py +0 -0
  78. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_splines.py +0 -0
  79. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/test_vector_spaces.py +0 -0
  80. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/tests/utilities.py +0 -0
  81. {feectools-0.4.0 → feectools-0.5.0}/feectools/fem/vector.py +0 -0
  82. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/__init__.py +0 -0
  83. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/direct_solvers.py +0 -0
  84. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/fft.py +0 -0
  85. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/__init__.py +0 -0
  86. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/matvec_kernels.py +0 -0
  87. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil2IJV_kernels.py +0 -0
  88. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil2coo_kernels.py +0 -0
  89. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_1d/__init__.py +0 -0
  90. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_1d/stencil_axpy_1d_cuda.cu +0 -0
  91. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_1d/stencil_axpy_1d_kernels.py +0 -0
  92. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_2d/__init__.py +0 -0
  93. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_2d/stencil_axpy_2d_cuda.cu +0 -0
  94. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_2d/stencil_axpy_2d_kernels.py +0 -0
  95. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_3d/__init__.py +0 -0
  96. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_3d/stencil_axpy_3d_cuda.cu +0 -0
  97. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_axpy_3d/stencil_axpy_3d_kernels.py +0 -0
  98. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_1d/__init__.py +0 -0
  99. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_1d/stencil_dot_1d_cuda.cu +0 -0
  100. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_1d/stencil_dot_1d_kernels.py +0 -0
  101. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_2d/__init__.py +0 -0
  102. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_2d/stencil_dot_2d_cuda.cu +0 -0
  103. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_2d/stencil_dot_2d_kernels.py +0 -0
  104. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_3d/__init__.py +0 -0
  105. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_3d/stencil_dot_3d_cuda.cu +0 -0
  106. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_dot_3d/stencil_dot_3d_kernels.py +0 -0
  107. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_1d/__init__.py +0 -0
  108. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_1d/stencil_inner_1d_cuda.cu +0 -0
  109. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_1d/stencil_inner_1d_kernels.py +0 -0
  110. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_2d/__init__.py +0 -0
  111. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_2d/stencil_inner_2d_cuda.cu +0 -0
  112. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_2d/stencil_inner_2d_kernels.py +0 -0
  113. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_3d/__init__.py +0 -0
  114. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_3d/stencil_inner_3d_cuda.cu +0 -0
  115. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_inner_3d/stencil_inner_3d_kernels.py +0 -0
  116. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_1d/__init__.py +0 -0
  117. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_1d/stencil_transpose_1d_cuda.cu +0 -0
  118. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_1d/stencil_transpose_1d_kernels.py +0 -0
  119. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_2d/__init__.py +0 -0
  120. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_2d/stencil_transpose_2d_cuda.cu +0 -0
  121. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_2d/stencil_transpose_2d_kernels.py +0 -0
  122. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_3d/__init__.py +0 -0
  123. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_3d/stencil_transpose_3d_cuda.cu +0 -0
  124. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/stencil_transpose_3d/stencil_transpose_3d_kernels.py +0 -0
  125. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kernels/transpose_kernels.py +0 -0
  126. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/kron.py +0 -0
  127. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/memory.py +0 -0
  128. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/solvers.py +0 -0
  129. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/sparse.py +0 -0
  130. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/__init__.py +0 -0
  131. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/cuda_parity_cases.py +0 -0
  132. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/kernel_test_args.py +0 -0
  133. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_axpy_ghost_sync.py +0 -0
  134. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_cuda_emulation.py +0 -0
  135. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_cuda_parity.py +0 -0
  136. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_device_matvec.py +0 -0
  137. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_kron_stencil_matrix.py +0 -0
  138. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_linalg.py +0 -0
  139. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_matrix_free.py +0 -0
  140. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/test_solvers.py +0 -0
  141. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/tests/utilities.py +0 -0
  142. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/topetsc.py +0 -0
  143. {feectools-0.4.0 → feectools-0.5.0}/feectools/linalg/utilities.py +0 -0
  144. {feectools-0.4.0 → feectools-0.5.0}/feectools/utilities/__init__.py +0 -0
  145. {feectools-0.4.0 → feectools-0.5.0}/feectools/utilities/quadratures.py +0 -0
  146. {feectools-0.4.0 → feectools-0.5.0}/feectools/utilities/utils.py +0 -0
  147. {feectools-0.4.0 → feectools-0.5.0}/feectools/version.py +0 -0
  148. {feectools-0.4.0 → feectools-0.5.0}/feectools.egg-info/dependency_links.txt +0 -0
  149. {feectools-0.4.0 → feectools-0.5.0}/feectools.egg-info/entry_points.txt +0 -0
  150. {feectools-0.4.0 → feectools-0.5.0}/feectools.egg-info/top_level.txt +0 -0
  151. {feectools-0.4.0 → feectools-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: feectools
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Slimmed-down fork of Psydac (https://github.com/pyccel/psydac) with less functionality and fewer dependencies.
5
5
  Author-email: Psydac development team <psydac@googlegroups.com>
6
6
  Maintainer-email: Stefan Possanner <stefan.possanner@ipp.mpg.de>, Max Lindqvist <max.lindqvist@ipp.mpg.de>, Yaman Güçlü <yaman.guclu@gmail.com>, Martin Campos Pinto <martin.campos-pinto@ipp.mpg.de>, Ahmed Ratnani <ratnaniahmed@gmail.com>
@@ -42,6 +42,7 @@ Requires-Dist: matplotlib
42
42
  Requires-Dist: pyyaml>=5.1
43
43
  Requires-Dist: packaging
44
44
  Requires-Dist: pyevtk
45
+ Requires-Dist: maybempi>=0.1.2
45
46
  Requires-Dist: cunumpy>=0.6.1
46
47
  Requires-Dist: pyccel>=2.1.0
47
48
  Requires-Dist: h5py
@@ -0,0 +1,7 @@
1
+ # Bind this rank to its own GPU (by its rank within the node) and create the CUDA context before MPI starts, as
2
+ # CUDA-aware MPI requires. Every feectools module imports this package first, and MPI starts only when a module
3
+ # imports `from maybempi import MPI` (maybempi uses mpi4py under an MPI launcher and a serial stand-in otherwise;
4
+ # MAYBEMPI=0/1 overrides the detection). A no-op on the NumPy backend.
5
+ from cunumpy.cuda import bind_local_device
6
+
7
+ bind_local_device()
@@ -3,8 +3,7 @@
3
3
  import cunumpy as xp
4
4
  from cunumpy.mpi import synchronize_for_mpi
5
5
  import numpy as np
6
- from feectools.ddm.mpi import mpi as MPI
7
-
6
+ from maybempi import MPI
8
7
  from .cart import CartDecomposition, find_mpi_type
9
8
  from .basic import CartDataExchanger
10
9
 
@@ -10,16 +10,8 @@ from itertools import product
10
10
 
11
11
  from cunumpy.xp import array_backend, to_numpy
12
12
 
13
- # Bind this rank to its own GPU (by its rank within the node) and create the
14
- # CUDA context before MPI is initialized, as CUDA-aware MPI requires. Must stay
15
- # above the feectools.ddm.mpi import, which initializes MPI as a side effect.
16
- # A no-op on the NumPy backend.
17
- from cunumpy.cuda import bind_local_device
18
-
19
- bind_local_device()
20
-
21
- from feectools.ddm.mpi import mpi as MPI
22
- from feectools.ddm.mpi import MockMPI
13
+ # The GPU of this rank is bound in feectools/__init__.py, before MPI starts.
14
+ from maybempi import MPI, is_serial
23
15
  from feectools.ddm.partition import compute_dims, partition_procs_per_patch
24
16
 
25
17
 
@@ -46,7 +38,7 @@ def find_mpi_type( dtype ):
46
38
  MPI datatype to be used for communication.
47
39
 
48
40
  """
49
- if not isinstance(MPI, MockMPI):
41
+ if not is_serial(MPI):
50
42
  if isinstance( dtype, MPI.Datatype ):
51
43
  mpi_type = dtype
52
44
  else:
@@ -92,7 +84,7 @@ class MultiPatchDomainDecomposition:
92
84
  def __init__(self, ncells, periods, comm=None, num_threads=None):
93
85
 
94
86
  assert len( ncells ) == len( periods )
95
- if not isinstance(MPI, MockMPI) and comm is not None:
87
+ if not is_serial(MPI) and comm is not None:
96
88
  assert isinstance( comm, MPI.Comm )
97
89
  num_threads = num_threads if num_threads else int(os.environ.get('OMP_NUM_THREADS', 1))
98
90
 
@@ -236,7 +228,7 @@ class DomainDecomposition:
236
228
  assert len( ncells ) == len( periods )
237
229
  assert all( n >=1 for n in ncells )
238
230
  assert all( isinstance( period, bool ) for period in periods )
239
- if isinstance(MPI, MockMPI):
231
+ if is_serial(MPI):
240
232
  comm = None
241
233
  else:
242
234
  if comm is not None:
@@ -1,8 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  from cunumpy.mpi import synchronize_for_mpi
4
- from feectools.ddm.mpi import mpi as MPI
5
-
4
+ from maybempi import MPI
6
5
  from .cart import InterfaceCartDecomposition, find_mpi_type
7
6
 
8
7
  __all__ = ('InterfaceCartDataExchanger',)
@@ -5,7 +5,7 @@ from cunumpy.mpi import synchronize_for_mpi
5
5
  import numpy as np
6
6
  from itertools import product
7
7
 
8
- from feectools.ddm.mpi import mpi as MPI
8
+ from maybempi import MPI
9
9
  from .cart import CartDecomposition, find_mpi_type
10
10
  from .basic import CartDataExchanger
11
11
 
@@ -14,7 +14,7 @@ from feectools.ddm.nonblocking_data_exchanger import NonBlockingCartDataExchange
14
14
  def run_cart_1d( data_exchanger_type, verbose=False ):
15
15
 
16
16
  import cunumpy as xp
17
- from feectools.ddm.mpi import mpi as MPI
17
+ from maybempi import MPI
18
18
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
19
19
 
20
20
  #---------------------------------------------------------------------------
@@ -9,7 +9,7 @@ from feectools.ddm.nonblocking_data_exchanger import NonBlockingCartDataExchange
9
9
  def run_cart_2d( data_exchanger_type, verbose=False , nprocs=None, reverse_axis=None):
10
10
 
11
11
  import cunumpy as xp
12
- from feectools.ddm.mpi import mpi as MPI
12
+ from maybempi import MPI
13
13
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
14
14
 
15
15
  #---------------------------------------------------------------------------
@@ -9,7 +9,7 @@ from feectools.ddm.nonblocking_data_exchanger import NonBlockingCartDataExchange
9
9
  def run_cart_3d( data_exchanger_type, verbose=False ):
10
10
 
11
11
  import cunumpy as xp
12
- from feectools.ddm.mpi import mpi as MPI
12
+ from maybempi import MPI
13
13
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
14
14
 
15
15
  #---------------------------------------------------------------------------
@@ -2,9 +2,7 @@ import numpy as np
2
2
  import pytest
3
3
 
4
4
  from feectools.ddm.cart import DomainDecomposition
5
- from feectools.ddm.mpi import mpi as MPI
6
-
7
-
5
+ from maybempi import MPI
8
6
  def _comm(parallel):
9
7
  return MPI.COMM_WORLD if parallel else None
10
8
 
@@ -41,7 +41,7 @@ def get_plus_starts_ends(minus_starts, minus_ends, minus_npts, plus_npts, minus_
41
41
  def run_carts_2d():
42
42
  import cunumpy as xp
43
43
 
44
- from feectools.ddm.mpi import mpi as MPI
44
+ from maybempi import MPI
45
45
  from feectools.ddm.cart import MultiPatchDomainDecomposition, CartDecomposition, create_interfaces_cart
46
46
  from feectools.ddm.blocking_data_exchanger import BlockingCartDataExchanger
47
47
  from feectools.ddm.interface_data_exchanger import InterfaceCartDataExchanger
@@ -5,8 +5,7 @@ We assume here that a tensor space is the product of fem spaces whom basis are
5
5
  of compact support
6
6
 
7
7
  """
8
- from feectools.ddm.mpi import mpi as MPI
9
-
8
+ from maybempi import MPI
10
9
  import cunumpy as xp
11
10
  import numpy as np
12
11
  import itertools
@@ -5,8 +5,7 @@
5
5
  #---------------------------------------------------------------------------#
6
6
  import time
7
7
 
8
- from feectools.ddm.mpi import mpi as MPI
9
-
8
+ from maybempi import MPI
10
9
  import cunumpy as xp
11
10
  import pytest
12
11
 
@@ -7,8 +7,7 @@ from feectools.fem.splines import SplineSpace
7
7
  from feectools.fem.tensor import TensorFemSpace
8
8
  from feectools.fem.vector import VectorFemSpace
9
9
  from feectools.ddm.cart import DomainDecomposition
10
- from feectools.ddm.mpi import mpi as MPI
11
-
10
+ from maybempi import MPI
12
11
  import cunumpy as xp
13
12
 
14
13
  def test_2d_1():
@@ -19,7 +19,7 @@ import numpy as np
19
19
  import matplotlib as mpl
20
20
  import matplotlib.pyplot as plt
21
21
  from PIL import Image
22
- from mpi4py import MPI
22
+ from maybempi import MPI
23
23
 
24
24
  from sympde.topology.domain import Square
25
25
  from sympde.topology.space import ScalarFunctionSpace
@@ -385,7 +385,7 @@ class LinearOperator(ABC):
385
385
 
386
386
  if not is_sparse:
387
387
  if comm is not None:
388
- from feectools.ddm.mpi import mpi as MPI
388
+ from maybempi import MPI
389
389
  comm.Allreduce(MPI.IN_PLACE, out, op=MPI.SUM)
390
390
  return out
391
391
 
@@ -1076,7 +1076,7 @@ class BlockLinearOperator(LinearOperator):
1076
1076
  if not self.codomain.parallel:
1077
1077
  return blocks, blocks_T
1078
1078
 
1079
- from feectools.ddm.mpi import mpi as MPI
1079
+ from maybempi import MPI
1080
1080
  from feectools.linalg.stencil import StencilInterfaceMatrix
1081
1081
 
1082
1082
  if not isinstance(self.codomain, BlockVectorSpace):
@@ -15,7 +15,7 @@ from cunumpy.mpi import synchronize_for_mpi
15
15
  from cunumpy.xp import array_backend
16
16
  from scipy.sparse import coo_matrix, diags as sp_diags
17
17
 
18
- from feectools.ddm.mpi import mpi as MPI
18
+ from maybempi import MPI
19
19
  from feectools.linalg.basic import VectorSpace, Vector, LinearOperator
20
20
  from feectools.linalg.memory import stencil_matrix_memory
21
21
  from feectools.ddm.cart import find_mpi_type, CartDecomposition, InterfaceCartDecomposition
@@ -5,7 +5,7 @@ import cunumpy as xp
5
5
  from scipy.sparse import csr_matrix
6
6
  from random import random, seed
7
7
 
8
- from feectools.ddm.mpi import mpi as MPI
8
+ from maybempi import MPI
9
9
  from feectools.linalg.direct_solvers import SparseSolver
10
10
  from feectools.linalg.stencil import StencilVectorSpace, StencilVector, StencilMatrix
11
11
  from feectools.linalg.block import BlockVectorSpace, BlockVector
@@ -7,7 +7,7 @@ import pytest
7
7
  import scipy.fft as scifft
8
8
  import cunumpy as xp
9
9
 
10
- from feectools.ddm.mpi import mpi as MPI
10
+ from maybempi import MPI
11
11
  from feectools.linalg.fft import *
12
12
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
13
13
  from feectools.linalg.stencil import StencilVector
@@ -23,7 +23,7 @@ import numpy as np
23
23
  import pytest
24
24
  import cunumpy as xp
25
25
 
26
- from feectools.ddm.mpi import mpi as MPI
26
+ from maybempi import MPI
27
27
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
28
28
  from feectools.linalg.stencil import StencilVectorSpace, StencilVector, StencilMatrix
29
29
 
@@ -231,7 +231,7 @@ def test_stencil_interface_matrix_3d_serial_init(dtype, n1, n2, n3, p1, p2, p3,
231
231
  @pytest.mark.mpi
232
232
  def test_stencil_interface_matrix_2d_parallel_dot(n1, n2, p1, p2, expected):
233
233
 
234
- from feectools.ddm.mpi import mpi as MPI
234
+ from maybempi import MPI
235
235
  from feectools.ddm.cart import MultiPatchDomainDecomposition, CartDecomposition, create_interfaces_cart
236
236
  from feectools.linalg.block import BlockVectorSpace, BlockVector, BlockLinearOperator
237
237
 
@@ -6,7 +6,7 @@
6
6
  import pytest
7
7
  import cunumpy as xp
8
8
 
9
- from feectools.ddm.mpi import mpi as MPI
9
+ from maybempi import MPI
10
10
  from feectools.linalg.stencil import StencilVectorSpace, StencilVector, StencilMatrix
11
11
  from feectools.linalg.utilities import array_to_psydac, petsc_to_psydac
12
12
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
@@ -6,7 +6,7 @@
6
6
  import pytest
7
7
  import cunumpy as xp
8
8
 
9
- from feectools.ddm.mpi import mpi as MPI
9
+ from maybempi import MPI
10
10
  from feectools.linalg.stencil import StencilVectorSpace, StencilVector
11
11
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition, find_mpi_type
12
12
 
@@ -6,7 +6,7 @@
6
6
  import pytest
7
7
  import cunumpy as xp
8
8
 
9
- from feectools.ddm.mpi import mpi as MPI
9
+ from maybempi import MPI
10
10
  from feectools.ddm.cart import DomainDecomposition, CartDecomposition
11
11
  from feectools.linalg.basic import LinearOperator, MatrixFreeLinearOperator, IdentityOperator
12
12
  from feectools.linalg.stencil import StencilVectorSpace, StencilMatrix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: feectools
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Slimmed-down fork of Psydac (https://github.com/pyccel/psydac) with less functionality and fewer dependencies.
5
5
  Author-email: Psydac development team <psydac@googlegroups.com>
6
6
  Maintainer-email: Stefan Possanner <stefan.possanner@ipp.mpg.de>, Max Lindqvist <max.lindqvist@ipp.mpg.de>, Yaman Güçlü <yaman.guclu@gmail.com>, Martin Campos Pinto <martin.campos-pinto@ipp.mpg.de>, Ahmed Ratnani <ratnaniahmed@gmail.com>
@@ -42,6 +42,7 @@ Requires-Dist: matplotlib
42
42
  Requires-Dist: pyyaml>=5.1
43
43
  Requires-Dist: packaging
44
44
  Requires-Dist: pyevtk
45
+ Requires-Dist: maybempi>=0.1.2
45
46
  Requires-Dist: cunumpy>=0.6.1
46
47
  Requires-Dist: pyccel>=2.1.0
47
48
  Requires-Dist: h5py
@@ -32,7 +32,6 @@ feectools/ddm/basic.py
32
32
  feectools/ddm/blocking_data_exchanger.py
33
33
  feectools/ddm/cart.py
34
34
  feectools/ddm/interface_data_exchanger.py
35
- feectools/ddm/mpi.py
36
35
  feectools/ddm/nonblocking_data_exchanger.py
37
36
  feectools/ddm/partition.py
38
37
  feectools/ddm/petsc.py
@@ -5,6 +5,7 @@ matplotlib
5
5
  pyyaml>=5.1
6
6
  packaging
7
7
  pyevtk
8
+ maybempi>=0.1.2
8
9
  cunumpy>=0.6.1
9
10
  pyccel>=2.1.0
10
11
  h5py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "feectools"
7
- version = "0.4.0"
7
+ version = "0.5.0"
8
8
  description = "Slimmed-down fork of Psydac (https://github.com/pyccel/psydac) with less functionality and fewer dependencies."
9
9
  readme = "README.md"
10
10
  requires-python = ">= 3.10"
@@ -30,6 +30,7 @@ dependencies = [
30
30
  'pyyaml >= 5.1',
31
31
  'packaging',
32
32
  'pyevtk',
33
+ 'maybempi >= 0.1.2',
33
34
  'cunumpy >= 0.6.1',
34
35
 
35
36
  # Our packages from PyPi
@@ -1,4 +0,0 @@
1
- # MPI switch, read once when feectools.ddm.mpi is first imported:
2
- # None -> use mpi4py if it is available (default)
3
- # False -> do not import mpi4py, use MockMPI (serial runs; saves ~1 s of import time)
4
- use_mpi = None
@@ -1,223 +0,0 @@
1
- """Detection of whether the process was launched by an MPI launcher.
2
-
3
- Importing ``mpi4py.MPI`` calls ``MPI_Init``, and any collective (``bcast``,
4
- ``Barrier``, ...) issued afterwards costs something even on a single process.
5
- A plain ``python script.py`` run should therefore never touch MPI at all, even
6
- when mpi4py happens to be installed. This module answers the only question
7
- that decides it: was this process started by ``mpirun``/``mpiexec``/``srun``
8
- (or an equivalent launcher)?
9
-
10
- The answer is read from the environment the launcher sets up, so it is
11
- available before mpi4py is imported.
12
- """
13
-
14
- import os
15
- import sys
16
-
17
- from dataclasses import dataclass
18
- from time import time
19
- from typing import TYPE_CHECKING
20
-
21
-
22
- # Per-process variables exported by the process managers behind the common
23
- # launchers. Each is set only for processes started *by* the launcher, so the
24
- # presence of any one of them means "this rank belongs to an MPI job".
25
- # SLURM_PROCID is deliberately absent: it is also set for the script of a
26
- # plain `sbatch` job, which is not an MPI launch. `srun` is covered by the
27
- # PMI/PMIX variables its MPI plugin exports.
28
- _LAUNCHER_ENV_VARS = (
29
- "OMPI_COMM_WORLD_RANK", # Open MPI (and derivatives: Spectrum, ...)
30
- "PMI_RANK", # MPICH, Intel MPI, MS-MPI, Cray, srun (pmi2)
31
- "PMIX_RANK", # PMIx, used by srun --mpi=pmix and Open MPI 5
32
- "MV2_COMM_WORLD_RANK", # MVAPICH2
33
- "MPI_LOCALRANKID", # Hydra (mpiexec.hydra)
34
- "ALPS_APP_PE", # Cray ALPS aprun
35
- "PALS_RANKID", # Cray PALS palsrun
36
- )
37
-
38
- # Escape hatch: force the decision either way without touching code, e.g. for
39
- # a launcher whose variables are not listed above.
40
- _OVERRIDE_ENV_VAR = "STRUPHY_MPI"
41
-
42
- _TRUE_VALUES = ("1", "true", "yes", "on")
43
- _FALSE_VALUES = ("0", "false", "no", "off")
44
-
45
-
46
- def _override() -> bool | None:
47
- """Value of ``STRUPHY_MPI``, or None if unset/unrecognized."""
48
- value = os.environ.get(_OVERRIDE_ENV_VAR)
49
- if value is None:
50
- return None
51
- value = value.strip().lower()
52
- if value in _TRUE_VALUES:
53
- return True
54
- if value in _FALSE_VALUES:
55
- return False
56
- return None
57
-
58
-
59
- def launched_under_mpi() -> bool:
60
- """Whether this process was started by an MPI launcher.
61
-
62
- Returns
63
- -------
64
- bool
65
- True if a launcher's per-rank environment variable is present, or if
66
- the application itself already initialized MPI (in which case using
67
- the communicator is free). ``STRUPHY_MPI=0``/``1`` overrides
68
- the detection.
69
- """
70
- override = _override()
71
- if override is not None:
72
- return override
73
-
74
- if any(var in os.environ for var in _LAUNCHER_ENV_VARS):
75
- return True
76
-
77
- # The application may have initialized MPI itself (embedded interpreter,
78
- # or an explicit `from mpi4py import MPI`). Only inspect mpi4py if it is
79
- # already imported: importing it here is exactly what must be avoided.
80
- mpi_module = sys.modules.get("mpi4py.MPI")
81
- if mpi_module is not None:
82
- try:
83
- return bool(mpi_module.Is_initialized())
84
- except AttributeError:
85
- return False
86
-
87
- return False
88
-
89
-
90
- # Might not be needed
91
- class MPICommWrapper:
92
- def __init__(self, use_mpi=True):
93
- self.use_mpi = use_mpi
94
- if use_mpi:
95
- from mpi4py import MPI
96
-
97
- self.comm = MPI.COMM_WORLD
98
- else:
99
- self.comm = MockComm()
100
-
101
- def __getattr__(self, name):
102
- return getattr(self.comm, name)
103
-
104
-
105
- class MockComm:
106
- def __getattr__(self, name):
107
- # Return a function that does nothing and returns None
108
- def dummy(*args, **kwargs):
109
- return None
110
-
111
- return dummy
112
-
113
- # Override some functions
114
- def Get_rank(self):
115
- return 0
116
-
117
- def Get_size(self):
118
- return 1
119
-
120
- def Barrier(self):
121
- return
122
-
123
-
124
- class MPIwrapper:
125
- def __init__(
126
- self,
127
- use_mpi: bool = False,
128
- verbose: bool = False,
129
- ):
130
- self.use_mpi = use_mpi
131
- if use_mpi:
132
- from mpi4py import MPI
133
-
134
- self._MPI = MPI
135
- if verbose:
136
- print("MPI is enabled")
137
- else:
138
- self._MPI = MockMPI()
139
- if verbose:
140
- print("MPI is NOT enabled")
141
-
142
- @property
143
- def MPI(self):
144
- return self._MPI
145
-
146
-
147
- class MockMPI:
148
- def __getattr__(self, name):
149
- # Return a function that does nothing and returns None
150
- def dummy(*args, **kwargs):
151
- return None
152
-
153
- return dummy
154
-
155
- # Override some functions
156
- @property
157
- def COMM_WORLD(self):
158
- return MockComm()
159
-
160
- # def comm_Get_rank(self):
161
- # return 0
162
-
163
- # def comm_Get_size(self):
164
- # return 1
165
-
166
-
167
- def _mpi_disabled():
168
- """True if the user or the host application opted out of MPI.
169
-
170
- Importing mpi4py initializes MPI, which takes close to a second. Serial runs that
171
- never use MPI can skip it entirely, in two ways:
172
-
173
- * export ``FEECTOOLS_MPI=0`` before starting Python, or
174
- * set ``feectools.use_mpi = False`` before this module is first imported
175
- (in-process, so it is not inherited by subprocesses such as ``mpirun``).
176
-
177
- The MockMPI wrapper below is then used, exactly as if mpi4py were not installed.
178
- """
179
- import os
180
-
181
- import feectools
182
-
183
- if getattr(feectools, 'use_mpi', None) is False:
184
- return True
185
- return os.environ.get('FEECTOOLS_MPI', '').strip().lower() in ('0', 'false', 'no', 'off')
186
-
187
-
188
- if launched_under_mpi():
189
- try:
190
- # MPI with the CuPy backend needs a CUDA-aware MPI library: device
191
- # buffers are passed to MPI directly (after synchronize_for_mpi, see
192
- # the data exchangers). A non-CUDA-aware MPI segfaults on them.
193
- if _mpi_disabled():
194
- raise ImportError("MPI disabled (feectools.use_mpi = False or FEECTOOLS_MPI=0)")
195
-
196
- from mpi4py import MPI
197
-
198
- _comm = MPI.COMM_WORLD
199
- # rank = _comm.Get_rank()
200
- # size = _comm.Get_size()
201
- mpi_enabled = True
202
- except ImportError:
203
- # mpi4py not installed
204
- mpi_enabled = False
205
- except Exception:
206
- # mpi4py installed but not running under mpirun
207
- mpi_enabled = False
208
- else:
209
- mpi_enabled = False
210
-
211
- # TODO: add environment variable for mpi use
212
- mpi_wrapper = MPIwrapper(
213
- use_mpi=mpi_enabled,
214
- verbose=False,
215
- )
216
-
217
- # TYPE_CHECKING is True when type checking (e.g., mypy), but False at runtime.
218
- if TYPE_CHECKING:
219
- from mpi4py import MPI
220
-
221
- mpi = MPI
222
- else:
223
- mpi = mpi_wrapper.MPI
File without changes
File without changes
File without changes
File without changes