Skip to content

Commit

Permalink
datatype: Add preliminary support for MPI_LOGICAL16
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Mar 21, 2024
1 parent e9a0e65 commit 64e5f5f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/ompi_setup_mpi_fortran.m4
Expand Up @@ -158,6 +158,8 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
[int32_t, int, int64_t, long long, long], [4], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*8], [yes],
[int, int64_t, long long, long], [8], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*16], [yes],
[int128_t, long long, long, int], [16], [yes])

OMPI_FORTRAN_CHECK([INTEGER], [yes],
[int32_t, int, int64_t, long long, long], [-1], [yes])
Expand Down
14 changes: 14 additions & 0 deletions ompi/datatype/ompi_datatype_internal.h
Expand Up @@ -247,6 +247,20 @@
# define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_UNAVAILABLE
#endif

#if OMPI_SIZEOF_FORTRAN_LOGICAL16 == OMPI_SIZEOF_FORTRAN_LOGICAL
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_LOGICAL
#elif OMPI_SIZEOF_FORTRAN_LOGICAL16 == 1
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_INT8_T
#elif OMPI_SIZEOF_FORTRAN_LOGICAL16 == 2
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_INT16_T
#elif OMPI_SIZEOF_FORTRAN_LOGICAL16 == 4
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_INT32_T
#elif OMPI_SIZEOF_FORTRAN_LOGICAL16 == 8
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_INT64_T
#else
# define OMPI_DATATYPE_MPI_LOGICAL16 OMPI_DATATYPE_MPI_UNAVAILABLE
#endif

/* INTEGER */
#if OMPI_SIZEOF_FORTRAN_INTEGER1 == OMPI_SIZEOF_FORTRAN_INTEGER
# define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INTEGER
Expand Down
5 changes: 5 additions & 0 deletions ompi/datatype/ompi_datatype_module.c
Expand Up @@ -223,6 +223,11 @@ ompi_predefined_datatype_t ompi_mpi_logical8 = OMPI_DATATYPE_INIT_PREDEFIN
#else
ompi_predefined_datatype_t ompi_mpi_logical8 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL8, OMPI_DATATYPE_FLAG_DATA_FORTRAN );
#endif
#if OMPI_HAVE_FORTRAN_LOGICAL16
ompi_predefined_datatype_t ompi_mpi_logical16 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL16, OMPI_SIZEOF_FORTRAN_LOGICAL16, OMPI_ALIGNMENT_FORTRAN_LOGICAL16, 0);
#else
ompi_predefined_datatype_t ompi_mpi_logical16 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL16, OMPI_DATATYPE_FLAG_DATA_FORTRAN );
#endif
#if OMPI_HAVE_FORTRAN_REAL2
ompi_predefined_datatype_t ompi_mpi_real2 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL2, OMPI_SIZEOF_FORTRAN_REAL2, OMPI_ALIGNMENT_FORTRAN_REAL2, OMPI_DATATYPE_FLAG_DATA_FLOAT);
#else
Expand Down
7 changes: 7 additions & 0 deletions ompi/include/mpi.h.in
Expand Up @@ -120,6 +120,9 @@
/* Whether we have FORTRAN LOGICAL*1 or not */
#undef OMPI_HAVE_FORTRAN_LOGICAL1

/* Whether we have FORTRAN LOGICAL*16 or not */
#undef OMPI_HAVE_FORTRAN_LOGICAL16

/* Whether we have FORTRAN LOGICAL*2 or not */
#undef OMPI_HAVE_FORTRAN_LOGICAL2

Expand Down Expand Up @@ -1140,6 +1143,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_logical1;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_logical2;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_logical4;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_logical8;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_logical16;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_integer1;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_integer2;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_integer4;
Expand Down Expand Up @@ -1287,6 +1291,9 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub;
#if OMPI_HAVE_FORTRAN_LOGICAL8
#define MPI_LOGICAL8 OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_logical8)
#endif
#if OMPI_HAVE_FORTRAN_LOGICAL16
#define MPI_LOGICAL16 OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_logical16)
#endif
#define MPI_INTEGER OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_integer)
#if OMPI_HAVE_FORTRAN_INTEGER1
#define MPI_INTEGER1 OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_integer1)
Expand Down
1 change: 1 addition & 0 deletions ompi/include/mpif-values.pl
Expand Up @@ -226,6 +226,7 @@ sub read_value_from_file {
$handles->{MPI_C_LONG_DOUBLE_COMPLEX} = 71;
$handles->{MPI_COUNT} = 72;
$handles->{MPI_COMPLEX4} = 73;
$handles->{MPI_LOGICAL16} = 74;

$handles->{MPI_MESSAGE_NO_PROC} = 1;

Expand Down
1 change: 1 addition & 0 deletions ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90
Expand Up @@ -154,6 +154,7 @@ module mpi_f08_types
type(MPI_Datatype), parameter :: MPI_LOGICAL2 = MPI_Datatype(OMPI_MPI_LOGICAL2)
type(MPI_Datatype), parameter :: MPI_LOGICAL4 = MPI_Datatype(OMPI_MPI_LOGICAL4)
type(MPI_Datatype), parameter :: MPI_LOGICAL8 = MPI_Datatype(OMPI_MPI_LOGICAL8)
type(MPI_Datatype), parameter :: MPI_LOGICAL16 = MPI_Datatype(OMPI_MPI_LOGICAL16)
type(MPI_Datatype), parameter :: MPI_C_BOOL = MPI_Datatype(OMPI_MPI_C_BOOL)
type(MPI_Datatype), parameter :: MPI_CXX_BOOL = MPI_Datatype(OMPI_MPI_CXX_BOOL)
type(MPI_Datatype), parameter :: MPI_COUNT = MPI_Datatype(OMPI_MPI_COUNT)
Expand Down

0 comments on commit 64e5f5f

Please sign in to comment.