Question
Coarray execution mode detection in Fortran 2018 compilers
Ira Lane
0 reputation · 16 Feb 2022, 05:40 UTC
56.1K views0
Goal
Determine at compile time whether a Fortran 2018 compiler build will launch a program with true multi‑image coarray execution or fall back to a single‑image serial run.
Constraints and Uncertainty
- Coarray syntax is part of the language, but the runtime that actually creates multiple images is supplied by the compiler or an external library.
- Many compilers accept coarray constructs without requiring a runtime flag, yet the program may still execute with one image unless a specific flag or environment variable is set.
- There is no standardized compile‑time query or pragma that reports the availability of multi‑image support.
Unresolved Decision
Should a Fortran 2018 conforming compiler provide a portable way—via a query intrinsic, compiler option, or environment variable—to indicate whether the build will support true coarray parallelism?
Specific Questions
- Is there an intrinsic or compiler flag in any Fortran 2018 implementation that reliably reports multi‑image support at compile time?
- What is the recommended practice for detecting and handling the single‑image fallback in portable coarray code?
- How do current compilers differ in their handling of this detection, and what impact does that have on portability across vendor toolchains?