Skip to content

Commit

Permalink
Skip test if adios2 python module built without MPI. (#3124)
Browse files Browse the repository at this point in the history
* This test only works if ADIOS2 was built with MPI.

* Require MPI ADIOS2 build during configuration.

* Reformat ruff.

* Require adios2.10 for given test

* Ruff

* Simplify

* Add back skip

---------

Co-authored-by: Garth N. Wells <gnw20@cam.ac.uk>
Co-authored-by: jorgensd <dokken92@gmail.com>
Co-authored-by: Jørgen S. Dokken <dokken@simula.no>
  • Loading branch information
4 people committed Sep 10, 2024
1 parent 6831fee commit fd47df4
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions python/test/unit/io/test_adios2.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ def test_vtx_reuse_mesh(self, tempdir, dim, simplex, reuse):
"""Test reusage of mesh by VTXWriter."""
from dolfinx.io import VTXMeshPolicy, VTXWriter

adios2 = pytest.importorskip("adios2")
adios2 = pytest.importorskip("adios2", minversion="2.10.0")
if not adios2.is_built_with_mpi:
pytest.skip("Require adios2 built with MPI support")

mesh = generate_mesh(dim, simplex)
v = Function(functionspace(mesh, ("Lagrange", 1)))
Expand All @@ -312,19 +314,12 @@ def test_vtx_reuse_mesh(self, tempdir, dim, simplex, reuse):

reuse_variables = ["NumberOfEntities", "NumberOfNodes", "connectivity", "geometry", "types"]
target_all = 3 # For all other variables the step count is number of writes
target_mesh = (
1 if reuse else 3
) # For mesh variables the step count is 1 if reuse else number of writes

# backwards compatibility adios2 < 2.10.0
try:
adios_file = adios2.open(str(filename), "r", comm=mesh.comm, engine_type="BP4")
except AttributeError:
# adios2 >= v2.10.0
adios = adios2.Adios(comm=mesh.comm)
io = adios.declare_io("TestData")
io.set_engine("BP4")
adios_file = adios2.Stream(io, str(filename), "r", mesh.comm)
target_mesh = 1 if reuse else 3
# For mesh variables the step count is 1 if reuse else number of writes
adios = adios2.Adios(comm=mesh.comm)
io = adios.declare_io("TestData")
io.set_engine("BP4")
adios_file = adios2.Stream(io, str(filename), "r", mesh.comm)

for name, var in adios_file.available_variables().items():
if name in reuse_variables:
Expand Down

0 comments on commit fd47df4

Please sign in to comment.