Skip to content

Resolve DECOMP_2D_COMM_CART_X from either 2decomp module (#330) - #496

Open
ia267 wants to merge 1 commit into
mainfrom
330_decomp_comm_cart_import
Open

ia267 wants to merge 1 commit into
mainfrom
330_decomp_comm_cart_import

Conversation

@ia267

@ia267 ia267 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #330.

2decomp-fft v2.2.0 moved DECOMP_2D_COMM_CART_X from decomp_2d to decomp_2d_mpi. In v2.2.0, decomp_2d is default-private and does not re-export it, so x3d2 fails to compile with gfortran against an external v2.2.0 install (via -Ddecomp2d_install_dir):

Error: Symbol 'decomp_2d_comm_cart_x' referenced at (1) not found in module 'decomp_2d'

The change suggested in the issue, importing it from decomp_2d_mpi, would break the pinned v2.0.3.2, where only decomp_2d defines it. nvfortran accepts the original import against v2.2.0, which is why our NVHPC builds never showed the error.

Change

  • Add a small helper, get_cart_x_comm(), that uses both decomp_2d and decomp_2d_mpi without only. The symbol resolves from whichever module defines it, so the code works with both layouts.
  • The helper has its own scope, so the full imports can't clash with names in decomposition_2decomp.

Testing

Compiler 2decomp Before After
gfortran 14.3 + OpenMPI 5.0.8 v2.2.0 (external) build fails builds, ctest passes
gfortran 14.3 + OpenMPI 5.0.8 v2.0.3.2 (bundled) n/a builds, ctest passes
nvfortran 25.3 v2.2.0 (external) builds builds

CI only builds the pinned v2.0.3.2, so it does not exercise the v2.2.0 path.

2decomp-fft v2.2.0 moved DECOMP_2D_COMM_CART_X from decomp_2d to
decomp_2d_mpi, and decomp_2d is default-private there, so importing it
from decomp_2d fails to compile (gfortran) against an external v2.2.0
install. Importing it from decomp_2d_mpi instead breaks the pinned
v2.0.3.2, where only decomp_2d defines it.

Read the communicator in a small helper that uses both modules without
ONLY, so it resolves from whichever one defines it, and keep the full
imports out of the decomposition routine's scope.
@ia267 ia267 added this to the Version 0.1.0 milestone Nov 22, 2026
@ia267
ia267 requested a review from kaanolgu November 22, 2026 01:42
@ia267 ia267 self-assigned this Nov 22, 2026
@ia267 ia267 added the bug Something isn't working label Nov 22, 2026
@ia267
ia267 marked this pull request as ready for review November 22, 2026 01:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get DECOMP_2D_COMM_CART_X from decomp_2d_mpi

1 participant