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
43 changes: 28 additions & 15 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([test "$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 Down Expand Up @@ -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 @@ -21,6 +21,7 @@ dnl Copyright (c) 2016-2022 IBM Corporation. All rights reserved.
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
dnl Copyright (c) 2022 Triad National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2026 NVIDIA Corporation. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -183,13 +184,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 @@ -198,7 +199,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 @@ -220,19 +221,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 @@ -406,6 +406,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 @@ -416,6 +417,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 @@ -441,6 +444,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 @@ -452,6 +458,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 @@ -501,6 +513,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 @@ -514,6 +529,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
10 changes: 6 additions & 4 deletions ompi/datatype/ompi_datatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* and Technology (RIST). All rights reserved.
* 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 @@ -59,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 Expand Up @@ -377,15 +379,15 @@ OMPI_DECLSPEC int ompi_datatype_safeguard_pointer_debug_breakpoint( const void*
int count );
#endif /* OPAL_ENABLE_DEBUG */

OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, int incount,
OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, size_t incount,
ompi_datatype_t *datatype, void *outbuf,
MPI_Aint outsize, MPI_Aint *position);

OMPI_DECLSPEC int ompi_datatype_unpack_external( const char datarep[], const void *inbuf, MPI_Aint insize,
MPI_Aint *position, void *outbuf, int outcount,
MPI_Aint *position, void *outbuf, size_t outcount,
ompi_datatype_t *datatype);

OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int incount,
OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], size_t incount,
ompi_datatype_t *datatype, MPI_Aint *size);

#define OMPI_DATATYPE_RETAIN(ddt) \
Expand Down
9 changes: 5 additions & 4 deletions ompi/datatype/ompi_datatype_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -29,7 +30,7 @@
#include "ompi/datatype/ompi_datatype.h"
#include "opal/datatype/opal_convertor.h"

int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int incount,
int ompi_datatype_pack_external(const char datarep[], const void *inbuf, size_t incount,
ompi_datatype_t *datatype, void *outbuf,
MPI_Aint outsize, MPI_Aint *position)
{
Expand Down Expand Up @@ -73,7 +74,7 @@ int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int inc
}

int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_Aint insize,
MPI_Aint *position, void *outbuf, int outcount,
MPI_Aint *position, void *outbuf, size_t outcount,
ompi_datatype_t *datatype)
{
int rc = MPI_SUCCESS;
Expand All @@ -92,7 +93,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_

/* Check for truncation */
opal_convertor_get_packed_size( &local_convertor, &size );
if( (*position + size) > (unsigned int)insize ) {
if( (*position + (MPI_Aint)size) > insize ) {
OBJ_DESTRUCT( &local_convertor );
return MPI_ERR_TRUNCATE;
}
Expand All @@ -112,7 +113,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_
return (rc == 1) ? OMPI_SUCCESS : MPI_ERR_UNKNOWN;
}

int ompi_datatype_pack_external_size(const char datarep[], int incount,
int ompi_datatype_pack_external_size(const char datarep[], size_t incount,
ompi_datatype_t *datatype, MPI_Aint *size)
{
opal_convertor_t local_convertor;
Expand Down
Loading