Skip to content

configury: test Fortran complex(real16) #13198

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ggouaillardet
Copy link
Contributor

Recent NVHPC compilers now support the REAL16 intrinsic from the ISO_FORTRAN_ENV module. Though they do support real(REAL16), they do not support complex(REAL16), causing a compilation error in the MPI_Sizeof() Fortran subroutine.

This patch does test complex(REAL16) on top of real(REAL16), and issue a warning and disable ISO_FORTRAN_ENV:REAL16 support if the former is not supported but the latter is.

Refs #13190

Recent NVHPC compilers now support the REAL16 intrinsic from
the ISO_FORTRAN_ENV module. Though they do support real(REAL16),
they do not support complex(REAL16), causing a compilation error
in the MPI_Sizeof() Fortran subroutine.

This patch does test complex(REAL16) on top of real(REAL16), and
issue a warning and disable ISO_FORTRAN_ENV:REAL16 support if the
former is not supported but the latter is.

Thanks Jorge Cabrera for reporting this.

Refs open-mpi#13190

Signed-off-by: Gilles Gouaillardet <[email protected]>
[AC_MSG_RESULT([no])
AC_MSG_WARN([*** Fortran compiler supports real(REAL16) but])
AC_MSG_WARN([*** does *not* support complex(REAL16)])
AC_MSG_WARN([*** Disabling support for ISO_FORTRAN_ENV:REAL16])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just create another type / plumb through complex(real16) such that we can support real16 and not support complex(real16)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffhammond explained former PGI based NVHPC compiler won't support complex(REAL16), but the future is with flang (LLVM) based compilers.
I don't think this is worth the hassle unless there is a real use-case for that.
#13190 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw @jeffhammond's comment, but I thought that that was exactly why we would want to do this. I.e., other compilers support REAL16 and support COMPLEX(REAL16). But the NV compiler doesn't -- and won't -- support REAL16 and COMPLEX(REAL16) -- it'll only support REAL16.

So if we test for both, and have proper test results for both, then we can handle any compiler that supports one or both. In reality, it'll only be the NV compiler that only supports one, but that's fine -- it's a generalized test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just turn OMPI_HAVE_FORTRAN_COMPLEX32 off and the datatype and op code should deal with having REAL16 but not COMPLEX32.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm fine with the solution proposed here, either you have both or none.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a quick grep and unless I missed something, this is only used in MPI_Sizeof().
So though it would be ideal to handle compilers (e.g. NVHPC) that support real(REAL16) but not complex(REAL16), I do not think this is worth the hassle and fixing compilation by disabling ISO_FORTRAN_ENV:REAL16 altogether is good enough for the time being.
Of course anyone is free to improve this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also used in the datatype and in the MPI Op via OMPI_HAVE_FORTRAN_COMPLEX32. But I would be surprised if it had any users. For the outcome, I'm with you this PR is good enough.

@ggouaillardet ggouaillardet marked this pull request as ready for review April 17, 2025 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants