Skip to content

Adapt to AMReX 26.02 Array4 API changes - #390

Open
lwJi wants to merge 3 commits into
EinsteinToolkit:mainfrom
lwJi:et-adapt-to-latest-amrex
Open

lwJi wants to merge 3 commits into
EinsteinToolkit:mainfrom
lwJi:et-adapt-to-latest-amrex

Conversation

@lwJi

@lwJi lwJi commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

AMReX 26.02 refactored Array4 into a specialization of the new ArrayND class (AMReX-Codes/amrex#4900). This changed the public member API that CarpetX relies on:

  • the Dim3 begin/end members became IntVectNDs, so vars.begin.x etc. no longer compile;
  • the public jstride/kstride/nstride members were replaced by a get_stride<d>() accessor;
  • the new headers use C++20 requires clauses, so building against AMReX ≥ 26.02 needs -std=c++20.

Changes

  • CarpetX: use the amrex::lbound/amrex::ubound free functions instead of the begin/end members in interpolate.cxx, io_tsv.cxx, and reduction.cxx. These functions exist in all AMReX versions, so this compiles against both old and new AMReX. Note that ubound is inclusive while the old end member was exclusive; loop bounds and asserts are adjusted accordingly.
  • ODESolvers: use Array4::get_stride() when building against AMReX ≥ 26.02, guarded by AMREX_RELEASE_NUMBER (the same pattern as the existing guard in CarpetX/src/fillpatch.cxx); the old stride members are kept for older AMReX.
  • scripts: bump the CI configs from C++17 to C++20, required for AMReX ≥ 26.02 and harmless for older versions.

No behavior change is intended; this is a pure API adaptation.

Tests

Built and ran the CarpetX testsuite against AMReX 26.07 (g++, macOS), which exercises the new (AMREX_RELEASE_NUMBER >= 260200) code path. The pre-26.02 code path in ODESolvers is textually unchanged and continues to compile against the AMReX shipped in the current CI containers.

These changes were originally developed and CI-tested (CPU/CUDA/ROCm/oneAPI, real32/real64) in lwJi#103.

lwJi added 3 commits July 16, 2026 11:36
The latest AMReX removed public access to Array4's begin/end members;
use the lbound/ubound accessors instead. Note that ubound is inclusive
where Array4::end was exclusive, so loop bounds and extent checks are
adjusted accordingly.
AMReX 26.02 replaced Array4's public jstride/kstride/nstride members
with a get_stride() accessor. Guard on AMREX_RELEASE_NUMBER so the
code keeps compiling against older AMReX releases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant