Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip test if adios2 python module built without MPI. #3124

Merged
merged 14 commits into from
Sep 10, 2024
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
Loading