Skip to content

Commit

Permalink
Restrict adios2 to main until new release (#135) (#141)
Browse files Browse the repository at this point in the history
* Restrict adios2 to main until new release (#135)

* Restrict adios2 to main until new release due to: ornladios/ADIOS2#4287

* Simplify try except

* Try new adios2 version

* Fix readpos

* Move to default and source installation

* Apply suggestions from code review

* Flattened topo as partition input (#126)

* Flattened topo as partition input

* Bump adios2 version on CI

* Add create connectivity prior to computing midpoints (#123)

* ADd incompatibility check to test for adios2 and numpy (#142)
  • Loading branch information
jorgensd authored Nov 22, 2024
1 parent 3e42d2c commit d6cf06f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
artifact_name: "legacy_checkpoint_mpich"

test-code:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs:
[create-datasets, create-legacy-datasets, check-formatting, get_image_tag]
container: ghcr.io/fenics/dolfinx/dolfinx:${{ needs.get_image_tag.outputs.image }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_package_openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

strategy:
matrix:
adios2: ["default", "v2.9.2", "v2.10.0"]
adios2: ["default", "v2.10.2"]
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

strategy:
matrix:
adios2: ["v2.10.0"]
adios2: ["v2.10.2"]
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 2 additions & 0 deletions docs/meshtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# Compute midpoints of entities
entities = np.arange(e_map.size_local, dtype=np.int32)
mesh.topology.create_connectivity(i, mesh.topology.dim)
entity_midpoints[i] = dolfinx.mesh.compute_midpoints(mesh, i, entities)
# Associate each local index with its global index
values = np.arange(e_map.size_local, dtype=np.int32) + e_map.local_range[0]
Expand Down Expand Up @@ -67,6 +68,7 @@ def verify_meshtags(filename: Path):
meshtags = adios4dolfinx.read_meshtags(filename, read_mesh, meshtag_name=f"meshtags_{i}")

# Compute midpoints for all local entities on process
read_mesh.topology.create_connectivity(i, read_mesh.topology.dim)
midpoints = dolfinx.mesh.compute_midpoints(read_mesh, i, meshtags.indices)
# Compare locally computed midpoint with reference data
for global_pos, midpoint in zip(meshtags.values, midpoints):
Expand Down
5 changes: 1 addition & 4 deletions src/adios4dolfinx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

meta = metadata("adios4dolfinx")
__version__ = meta["Version"]
try:
__author__ = meta["Author"]
except KeyError:
pass
__author__ = meta.get("Author", "")
__license__ = meta["License"]
__email__ = meta["Author-email"]
__program_name__ = meta["Name"]
Expand Down
2 changes: 1 addition & 1 deletion src/adios4dolfinx/checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def read_mesh_data(
)

def partitioner(comm: MPI.Intracomm, n, m, topo):
assert len(partition_graph.offsets) - 1 == topo.num_nodes
assert len(topo[0]) % (len(partition_graph.offsets) - 1) == 0
return partition_graph
else:
partitioner = dolfinx.cpp.mesh.create_cell_partitioner(ghost_mode)
Expand Down
2 changes: 1 addition & 1 deletion src/adios4dolfinx/legacy_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def read_dofmap_legacy(
# Extract dofmap data
global_dofs = np.zeros_like(cells, dtype=np.int64)
input_cell_positions = cells - local_cell_range[0]
read_pos = in_offsets[input_cell_positions].astype(np.int32) + dof_pos - in_offsets[0]
read_pos = (in_offsets[input_cell_positions] + dof_pos - in_offsets[0]).astype(np.int32)
global_dofs = mapped_dofmap[read_pos]
del input_cell_positions, read_pos

Expand Down
6 changes: 6 additions & 0 deletions tests/test_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

from mpi4py import MPI

import adios2
import numpy as np
import pytest
from packaging.version import parse as _v

import adios4dolfinx


@pytest.mark.skipif(
_v(np.__version__) >= _v("2.0.0") and _v(adios2.__version__) < _v("2.10.2"),
reason="Cannot use numpy>=2.0.0 and adios2<2.10.2",
)
@pytest.mark.parametrize("comm", [MPI.COMM_SELF, MPI.COMM_WORLD])
def test_read_write_attributes(comm, tmp_path):
attributes1 = {
Expand Down
2 changes: 2 additions & 0 deletions tests/test_mesh_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ def compute_distance_matrix(points_A, points_B, tol=1e-12):
new_cell_map = mesh_adios.topology.index_map(mesh_adios.topology.dim)
assert cell_map.size_local == new_cell_map.size_local
assert cell_map.num_ghosts == new_cell_map.num_ghosts
mesh.topology.create_connectivity(mesh.topology.dim, mesh.topology.dim)
midpoints = dolfinx.mesh.compute_midpoints(
mesh,
mesh.topology.dim,
np.arange(cell_map.size_local + cell_map.num_ghosts, dtype=np.int32),
)
mesh_adios.topology.create_connectivity(mesh_adios.topology.dim, mesh_adios.topology.dim)
new_midpoints = dolfinx.mesh.compute_midpoints(
mesh_adios,
mesh_adios.topology.dim,
Expand Down
1 change: 1 addition & 0 deletions tests/test_meshtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate_reference_map(
Returns:
Root rank returns the map, all other ranks return None
"""
mesh.topology.create_connectivity(meshtag.dim, mesh.topology.dim)
midpoints = dolfinx.mesh.compute_midpoints(mesh, meshtag.dim, meshtag.indices)
e_map = mesh.topology.index_map(meshtag.dim)
value_to_midpoint = {}
Expand Down

0 comments on commit d6cf06f

Please sign in to comment.