Skip to content
Open
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
7 changes: 5 additions & 2 deletions config/ompi_fortran_check.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
dnl Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -115,7 +116,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK], [
# the same format -- so the compiler is allowed to define
# C_LONG_DOUBLE to -1).

AC_MSG_CHECKING([for corresponding KIND value of $1])
AC_MSG_CHECKING([for corresponding KIND value of $1 (C type $ofc_c_type)])
case "$ofc_c_type" in
char) ofc_type_kind=C_SIGNED_CHAR ;;
double) ofc_type_kind=C_DOUBLE ;;
Expand All @@ -136,6 +137,8 @@ AC_DEFUN([OMPI_FORTRAN_CHECK], [
long*double*_Complex) ofc_type_kind=C_LONG_DOUBLE_COMPLEX ;;
opal_short_float_t) ofc_type_kind=C_SHORT_FLOAT ;;
opal_short_float_complex_t) ofc_type_kind=C_SHORT_FLOAT_COMPLEX ;;
_Float128) ofc_type_kind=C__FLOAT128 ;;
__float128) ofc_type_kind=C___FLOAT128 ;;
*)
# Skip types like "DOUBLE PRECISION"
;;
Expand Down Expand Up @@ -182,7 +185,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK], [
[Alignment of Fortran $1])
AC_DEFINE_UNQUOTED([OMPI_KIND_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]),
[$ofc_type_kind],
[Fortrn KIND number for $1])
[Fortran KIND number for $1])
if test "$3" != "" && test "$ofc_define_type" = "yes"; then
AC_DEFINE_UNQUOTED([ompi_fortran_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [A-Z], [a-z])[_t],
[$ofc_c_type],
Expand Down
45 changes: 29 additions & 16 deletions config/ompi_fortran_check_real16_c_equiv.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dnl Copyright (c) 2008-2016 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -43,26 +44,38 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_REAL16_C_EQUIV],[
# type that might work
AS_IF([test "$fortran_real16_happy" = "no"],
[AC_MSG_RESULT([$fortran_real16_happy])
# Intel compiler has a special type that should work
AS_IF([test "$opal_cv_c_compiler_vendor" = "intel"],
[AC_MSG_CHECKING([if intel compiler _Quad == REAL*16])
CFLAGS_save="$CFLAGS"
OPAL_FLAGS_APPEND_UNIQ([CFLAGS], ["-Qoption,cpp,--extended_float_types"])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([_Quad], [q])
AS_IF([test "$fortran_real16_happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="_Quad"
AC_MSG_RESULT([works!])],
[CFLAGS="$CFLAGS_save"
AC_MSG_RESULT([does not work])])
])
AS_IF([test "$opal_cv_c_compiler_vendor" = "gnu" && test "$ac_cv_type___float128" = "yes"],
[AC_MSG_CHECKING([if gnu compiler __float128 == REAL*16])
AS_IF([test "$ac_cv_type__Float128" = "yes"],
[AC_MSG_CHECKING([if the compiler _Float128 == REAL*16])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([_Float128], [q])
AS_IF([test "$fortran_real16_happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="_Float128"
AC_MSG_RESULT([works!])],
[AC_MSG_RESULT([does not work])])
])
# Try first the more widely available __float128
AS_IF([test "$fortran_real16_happy" = "no" && test "$ac_cv_type___float128" = "yes"],
[AC_MSG_CHECKING([if the compiler __float128 == REAL*16])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([__float128], [q])
AS_IF([test "$fortran_real16_happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="__float128"
AC_MSG_RESULT([works!])],
[AC_MSG_RESULT([does not work])])
])
# As recent Intel compilers identify as GNU we will always test for Quad support if no other tests were succesfull
AS_IF([test "$fortran_real16_happy" = "no"],
AC_CHECK_TYPES(_Quad)
[AS_IF(["$ac_cv_type__Quad" = "yes"],
[AC_MSG_CHECKING([if the compiler _Quad == REAL*16])
CFLAGS_save="$CFLAGS"
OPAL_FLAGS_APPEND_UNIQ([CFLAGS], ["-Qoption,cpp,--extended_float_types"])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([_Quad], [q])
AS_IF([test "$fortran_real16_happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="_Quad"
AC_MSG_RESULT([works!])],
[CFLAGS="$CFLAGS_save"
AC_MSG_RESULT([does not work])])
])
])
# We have to [re-]print a new message here, because
# AC_CACHE_CHECK will automatically AC_MSG_RESULT
AC_MSG_CHECKING([for C type matching bit representation of REAL*16])
Expand All @@ -85,7 +98,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_REAL16_C_EQUIV],[
[define_value=0
AC_MSG_WARN([MPI_REAL16 and MPI_COMPLEX32 support have been disabled])])
AC_DEFINE_UNQUOTED([OMPI_REAL16_MATCHES_C], [$define_value],
[Whether Fortran REAL*16 matches the bit format of the equivalent C type])
[Whether Fortran REAL*16 matches the bit format of the equivalent C type ($OMPI_FORTRAN_REAL16_C_TYPE)])
OPAL_VAR_SCOPE_POP
])

Expand All @@ -102,7 +115,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE],[
extern "C" {
#endif

void c_backend($1 *a) {
static void c_backend($1 *a) {
$1 foo = 11;
FILE *fp = fopen("conftestval", "w");
if (NULL == fp) exit(1);
Expand Down
17 changes: 9 additions & 8 deletions config/ompi_setup_mpi_fortran.m4
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
dnl Copyright (c) 2022 Triad National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2025 Stony Brook University. All rights reserved.
dnl Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -182,13 +183,13 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
[short float, float, double, long double, opal_short_float_t],
[2], [yes])
OMPI_FORTRAN_CHECK([REAL*4], [no],
[short float, float, double, long double, opal_short_float_t],
[long double, double, float, short float, opal_short_float_t],
[4], [yes])
OMPI_FORTRAN_CHECK([REAL*8], [no],
[short float, float, double, long double, opal_short_float_t],
[long double, double, float, short float, opal_short_float_t],
[8], [yes])
OMPI_FORTRAN_CHECK([REAL*16], [no],
[short float, float, double, long double, opal_short_float_t],
[_Float128, __float128, long double, double, float, short float, opal_short_float_t],
[16], [yes])

# In some compilers, the bit representation of REAL*16 is not the same
Expand All @@ -197,7 +198,7 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
OMPI_FORTRAN_CHECK_REAL16_C_EQUIV

OMPI_FORTRAN_CHECK([DOUBLE PRECISION], [yes],
[short float, float, double, long double, opal_short_float_t],
[long double, double, float, short float, opal_short_float_t],
[-1], [yes])

OMPI_FORTRAN_CHECK([COMPLEX], [yes],
Expand All @@ -219,19 +220,19 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
[short float _Complex, float _Complex, double _Complex, long double _Complex, opal_short_float_complex_t],
[4], [no])
OMPI_FORTRAN_CHECK([COMPLEX*8], [no],
[short float _Complex, float _Complex, double _Complex, long double _Complex, opal_short_float_complex_t],
[long double _Complex, double _Complex, float _Complex, short float _Complex, opal_short_float_complex_t],
[8], [no])
OMPI_FORTRAN_CHECK([COMPLEX*16], [no],
[short float _Complex, float _Complex, double _Complex, long double _Complex, opal_short_float_complex_t],
[long double _Complex, double _Complex, float _Complex, short float _Complex, opal_short_float_complex_t],
[16], [no])
OMPI_FORTRAN_CHECK([COMPLEX*32], [no],
[short float _Complex, float _Complex, double _Complex, long double _Complex, opal_short_float_complex_t],
[_Float128 _Complex, long double _Complex, double _Complex, float _Complex, short float _Complex, opal_short_float_complex_t],
[32], [no])
# Double precision complex types are not standard, but many
# compilers support it. Code should be wrapped with #ifdef
# OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX
OMPI_FORTRAN_CHECK([DOUBLE COMPLEX], [no],
[short float _Complex, float _Complex, double _Complex, long double _Complex, opal_short_float_complex_t],
[long double _Complex, double _Complex, float _Complex, short float _Complex, opal_short_float_complex_t],
[-1], [no])

# Regardless of whether we have fortran bindings, or even a
Expand Down
23 changes: 22 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2011-2026 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
Expand Down Expand Up @@ -415,6 +415,7 @@ AC_CHECK_TYPES(__int128)
AC_CHECK_TYPES(uint128_t)
AC_CHECK_TYPES(long long)

AC_CHECK_TYPES(_Float128)
AC_CHECK_TYPES(__float128)
AC_CHECK_TYPES(short float)
AC_CHECK_TYPES(long double)
Expand All @@ -425,6 +426,8 @@ AC_CHECK_TYPES(short float _Complex)
AC_CHECK_TYPES(float _Complex)
AC_CHECK_TYPES(double _Complex)
AC_CHECK_TYPES(long double _Complex)
AC_CHECK_TYPES(_Float128 _Complex)
AC_CHECK_TYPES(__float128 _Complex)

AC_CHECK_TYPES(intptr_t)
AC_CHECK_TYPES(uintptr_t)
Expand All @@ -450,6 +453,9 @@ fi
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
if test "$ac_cv_type__Float128" = yes; then
AC_CHECK_SIZEOF(_Float128)
fi
if test "$ac_cv_type___float128" = yes; then
AC_CHECK_SIZEOF(__float128)
fi
Expand All @@ -461,6 +467,12 @@ fi
AC_CHECK_SIZEOF(float _Complex)
AC_CHECK_SIZEOF(double _Complex)
AC_CHECK_SIZEOF(long double _Complex)
if test "$ac_cv_type__Float128__Complex" = yes; then
AC_CHECK_SIZEOF(_Float128 _Complex)
fi
if test "$ac_cv_type___float128__Complex" = yes; then
AC_CHECK_SIZEOF(__float128 _Complex)
fi

AC_CHECK_SIZEOF(void *)
AS_IF([test "$ac_cv_sizeof_void_p" -eq 4],
Expand Down Expand Up @@ -510,6 +522,9 @@ fi
OPAL_C_GET_ALIGNMENT(float, OPAL_ALIGNMENT_FLOAT)
OPAL_C_GET_ALIGNMENT(double, OPAL_ALIGNMENT_DOUBLE)
OPAL_C_GET_ALIGNMENT(long double, OPAL_ALIGNMENT_LONG_DOUBLE)
if test "$ac_cv_type__Float128" = yes; then
OPAL_C_GET_ALIGNMENT(_Float128, OPAL_ALIGNMENT__FLOAT128)
fi
if test "$ac_cv_type___float128" = yes; then
OPAL_C_GET_ALIGNMENT(__float128, OPAL_ALIGNMENT___FLOAT128)
fi
Expand All @@ -523,6 +538,12 @@ fi
OPAL_C_GET_ALIGNMENT(float _Complex, OPAL_ALIGNMENT_FLOAT_COMPLEX)
OPAL_C_GET_ALIGNMENT(double _Complex, OPAL_ALIGNMENT_DOUBLE_COMPLEX)
OPAL_C_GET_ALIGNMENT(long double _Complex, OPAL_ALIGNMENT_LONG_DOUBLE_COMPLEX)
if test "$ac_cv_type__Float128__Complex" = yes; then
OPAL_C_GET_ALIGNMENT(_Float128 _Complex, OPAL_ALIGNMENT__FLOAT128_COMPLEX)
fi
if test "$ac_cv_type___float128__Complex" = yes; then
OPAL_C_GET_ALIGNMENT(__float128 _Complex, OPAL_ALIGNMENT___FLOAT128_COMPLEX)
fi

OPAL_C_GET_ALIGNMENT(void *, OPAL_ALIGNMENT_VOID_P)
OPAL_C_GET_ALIGNMENT(size_t, OPAL_ALIGNMENT_SIZE_T)
Expand Down
3 changes: 2 additions & 1 deletion ompi/datatype/ompi_datatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2021 IBM Corporation. All rights reserved.
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
* Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -60,7 +61,7 @@ BEGIN_C_DECLS
#define OMPI_DATATYPE_FLAG_DATA_FORTRAN 0xC000
#define OMPI_DATATYPE_FLAG_DATA_LANGUAGE 0xC000

#define OMPI_DATATYPE_MAX_PREDEFINED 52
#define OMPI_DATATYPE_MAX_PREDEFINED 53

#if OMPI_DATATYPE_MAX_PREDEFINED > OPAL_DATATYPE_MAX_SUPPORTED
#error Need to increase the number of supported dataypes by OPAL (value OPAL_DATATYPE_MAX_SUPPORTED).
Expand Down
30 changes: 19 additions & 11 deletions ompi/datatype/ompi_datatype_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2018 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -28,7 +29,7 @@
#ifndef OMPI_DATATYPE_INTERNAL_H
#define OMPI_DATATYPE_INTERNAL_H

#include "opal/datatype/opal_datatype_internal.h"
#include "opal/datatype/opal_datatype_constructors.h"
#include "ompi/datatype/ompi_datatype.h"

/*
Expand Down Expand Up @@ -115,8 +116,13 @@
#define OMPI_DATATYPE_MPI_LONG 0x32
#define OMPI_DATATYPE_MPI_UNSIGNED_LONG 0x33

/*
* Datatypes with different representations between C and Fortran
*/
#define OMPI_DATATYPE_MPI_FLOAT128 0x34

/* This should __ALWAYS__ stay last */
#define OMPI_DATATYPE_MPI_UNAVAILABLE 0x34
#define OMPI_DATATYPE_MPI_UNAVAILABLE 0x35


#define OMPI_DATATYPE_MPI_MAX_PREDEFINED (OMPI_DATATYPE_MPI_UNAVAILABLE+1)
Expand Down Expand Up @@ -380,17 +386,19 @@

#if OMPI_SIZEOF_FORTRAN_REAL16 == OMPI_SIZEOF_FORTRAN_REAL
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_REAL
#elif (defined(HAVE_SHORT_FLOAT) && OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_SHORT_FLOAT) || \
#elif defined(HAVE__FLOAT128) && OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF__FLOAT128 && defined(OMPI_REAL16_MATCHES_C)
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_FLOAT128
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_LONG_DOUBLE && defined(OMPI_REAL16_MATCHES_C)
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_LONG_DOUBLE
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_DOUBLE && defined(OMPI_REAL16_MATCHES_C)
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_DOUBLE
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_FLOAT && defined(OMPI_REAL16_MATCHES_C)
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_FLOAT
#elif (defined(HAVE_SHORT_FLOAT) && OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_SHORT_FLOAT && defined(OMPI_REAL16_MATCHES_C)) || \
(defined(HAVE_OPAL_SHORT_FLOAT_T) && OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_OPAL_SHORT_FLOAT_T)
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_SHORT_FLOAT
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_FLOAT
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_FLOAT
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_DOUBLE
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_DOUBLE
#elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_LONG_DOUBLE
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_LONG_DOUBLE
#else
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_UNAVAILABLE
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_UNAVAILABLE
#endif

/*
Expand Down Expand Up @@ -603,7 +611,7 @@ extern const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX
#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT4
#elif SIZEOF_LONG_DOUBLE == 8
#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT8
#elif SIZEOF_LONG_DOUBLE == 12
#elif SIZEOF_LONG_DOUBLE >= 12 && LDBL_MANT_DIG <= 64
#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT12
#elif SIZEOF_LONG_DOUBLE == 16
#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT16
Expand Down
3 changes: 3 additions & 0 deletions ompi/datatype/ompi_datatype_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Copyright (c) 2018-2021 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
* Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -397,6 +398,8 @@ const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEF
[OMPI_DATATYPE_MPI_SHORT_FLOAT] = &ompi_mpi_short_float.dt,
[OMPI_DATATYPE_MPI_C_SHORT_FLOAT_COMPLEX] = &ompi_mpi_c_short_float_complex.dt,

[OMPI_DATATYPE_MPI_FLOAT128] = &ompi_mpi_real16.dt,

[OMPI_DATATYPE_MPI_UNAVAILABLE] = &ompi_mpi_unavailable.dt,
};

Expand Down
3 changes: 3 additions & 0 deletions ompi/op/op.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -235,6 +236,8 @@ int ompi_op_init(void)
ompi_op_ddt_map[OMPI_DATATYPE_MPI_LONG] = OMPI_OP_BASE_TYPE_LONG;
ompi_op_ddt_map[OMPI_DATATYPE_MPI_UNSIGNED_LONG] = OMPI_OP_BASE_TYPE_UNSIGNED_LONG;

ompi_op_ddt_map[OMPI_DATATYPE_MPI_FLOAT128] = OMPI_OP_BASE_TYPE_REAL16;

/* Create the intrinsic ops */

if (OMPI_SUCCESS !=
Expand Down
Loading
Loading