Skip to content

fortran: check for ISO_FORTRAN_ENV:REAL16 #8637

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions config/ompi_fortran_check_iso_fortran_env_real16.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2021 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

# Check whether or not the Fortran compiler supports the non standard
# iso_fortran_env:real16 or not
#
# OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV_REAL16([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV_REAL16],[
AS_VAR_PUSHDEF([iso_fortran_env_var_real16], [ompi_cv_fortran_have_iso_fortran_env_real16])

AC_CACHE_CHECK([if Fortran compiler supports ISO_FORTRAN_ENV:REAL16], iso_fortran_env_var_real16,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_iso_fortran_env_real16
use, intrinsic :: iso_fortran_env
real(REAL16) :: var
var = 12.34
end program]])],
[AS_VAR_SET(iso_fortran_env_var_real16, yes)],
[AS_VAR_SET(iso_fortran_env_var_real16, no)])
AC_LANG_POP([Fortran])
])

AS_VAR_IF(iso_fortran_env_var_real16, [yes], [$1], [$2])
AS_VAR_POPDEF([iso_fortran_env_var_real16])
])
9 changes: 8 additions & 1 deletion config/ompi_setup_mpi_fortran.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2014-2020 Research Organization for Information Science
dnl Copyright (c) 2014-2021 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
Expand Down Expand Up @@ -328,6 +328,13 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
[OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=0])])
AC_SUBST(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV)

# The non standard iso_fortran_env:real16 can be used for MPI_SIZEOF
OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16=0
AS_IF([test $ompi_fortran_happy -eq 1],
[OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV_REAL16(
[OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16=1])])
AC_SUBST(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16)

# Ensure that the fortran compiler supports STORAGE_SIZE for
# enough relevant types.
AS_IF([test $ompi_fortran_happy -eq 1],
Expand Down
5 changes: 3 additions & 2 deletions ompi/include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2014-2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2014-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
# $COPYRIGHT$
#
Expand Down Expand Up @@ -88,6 +88,7 @@ mpif-sizeof.h:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down
18 changes: 12 additions & 6 deletions ompi/mpi/fortran/base/gen-mpi-sizeof.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
#
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015-2018 Research Organization for Information Science
# Copyright (c) 2015-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
Expand Down Expand Up @@ -33,6 +33,7 @@
my $generate_arg;
my $mpi_arg;
my $mpi_real2;
my $mpi_iso_real16;
my $mpi_real16;
my $mpi_complex4;
my $mpi_complex32;
Expand All @@ -51,6 +52,7 @@
"pmpi" => \$pmpi_arg,
"real16=i" => \$mpi_real16,
"real2=i" => \$mpi_real2,
"iso_real16=i" => \$mpi_iso_real16,
"help|h" => \$help_arg);

die "Must specify header and/or impl filenames to output"
Expand All @@ -64,8 +66,8 @@
die "Must specify --pmpi and/or --mpi if --impl is specified"
if (defined($generate_arg) && $generate_arg &&
(defined($impl_arg) && !defined($mpi_arg) && !defined($pmpi_arg)));
die "Must specify real2, real16, complex4, and complex32"
if (!defined($mpi_real2) || !defined($mpi_real16) ||
die "Must specify real2, iso_real16, real16, complex4, and complex32"
if (!defined($mpi_real2) || !defined($mpi_iso_real16) || !defined($mpi_real16) ||
!defined($mpi_complex4) || !defined($mpi_complex32));

#############################################################################
Expand Down Expand Up @@ -154,15 +156,19 @@ sub generate {
queue_sub("integer(int${size})", "int${size}", "int${size}");
}
for my $size (qw/16 32 64 128/) {
if (!($size == 16 && $mpi_real2 == 0) &&
!($size == 128 &&$mpi_real16 == 0)) {
if (!($size == 16 && $mpi_real2 == 0 && $mpi_iso_real16 == 0) &&
!($size == 128 && $mpi_real16 == 0)) {
queue_sub("real(real${size})", "real${size}", "real${size}");
}
if (!($size == 16 && $mpi_complex4 == 0) &&
if (!($size == 16 && $mpi_complex4 == 0 && $mpi_iso_real16 == 0) &&
!($size == 128 && $mpi_complex32 == 0)) {
queue_sub("complex(real${size})", "complex${size}", "real${size}");
}
}
if ($mpi_real2 == 1 && $mpi_iso_real16 == 0) {
queue_sub("real*2", "real16");
queue_sub("complex*4", "complex16");
}
queue_sub("character", "character");
queue_sub("logical", "logical");

Expand Down
3 changes: 2 additions & 1 deletion ompi/mpi/fortran/mpif-h/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Copyright (c) 2011-2013 Universite Bordeaux 1
# Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015-2020 Research Organization for Information Science
# Copyright (c) 2015-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
Expand Down Expand Up @@ -122,6 +122,7 @@ sizeof_f.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down
3 changes: 2 additions & 1 deletion ompi/mpi/fortran/mpif-h/profile/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Copyright (c) 2011-2013 Universite Bordeaux 1
# Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015-2020 Research Organization for Information Science
# Copyright (c) 2015-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -446,6 +446,7 @@ psizeof_f.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down
5 changes: 4 additions & 1 deletion ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (c) 2012-2013 Inria. All rights reserved.
# Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015-2020 Research Organization for Information Science
# Copyright (c) 2015-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved.
Expand Down Expand Up @@ -75,6 +75,7 @@ sizeof_f08.h:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand All @@ -87,6 +88,7 @@ sizeof_f08.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand All @@ -99,6 +101,7 @@ profile/psizeof_f08.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down
4 changes: 3 additions & 1 deletion ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015-2020 Research Organization for Information Science
# Copyright (c) 2015-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
#
Expand Down Expand Up @@ -102,6 +102,7 @@ mpi-ignore-tkr-sizeof.h:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand All @@ -114,6 +115,7 @@ mpi-ignore-tkr-sizeof.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down
4 changes: 3 additions & 1 deletion ompi/mpi/fortran/use-mpi-tkr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2014-2020 Research Organization for Information Science
# Copyright (c) 2014-2021 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
Expand Down Expand Up @@ -138,6 +138,7 @@ mpi-tkr-sizeof.h:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand All @@ -150,6 +151,7 @@ mpi-tkr-sizeof.f90:
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
--real2=$(OMPI_HAVE_FORTRAN_REAL2) \
--iso_real16=$(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV_REAL16) \
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
--complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
Expand Down