Skip to content

Commit c44599e

Browse files
committed
mpiext/shortfloat: Add shortfloat MPI extension
This extension provides additional MPI datatypes `MPIX_SHORT_FLOAT`, `MPIX_C_SHORT_FLOAT_COMPLEX`, and `MPIX_CXX_SHORT_FLOAT_COMPLEX` for `short float` (C/C++), `short float _Complex` (C), and `std::complex<short float>` (C++), respectively, or their alternate types like `_Float16`. See `ompi/mpiext/shortfloat/README.txt` for details. Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com>
1 parent 4d7bde2 commit c44599e

File tree

14 files changed

+263
-3
lines changed

14 files changed

+263
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ ompi/mpiext/pcollreq/mpif-h/profile/pscan_init_f.c
300300
ompi/mpiext/pcollreq/mpif-h/profile/pscatter_init_f.c
301301
ompi/mpiext/pcollreq/mpif-h/profile/pscatterv_init_f.c
302302

303+
ompi/mpiext/shortfloat/c/mpiext_shortfloat_c.h
304+
ompi/mpiext/shortfloat/mpif-h/mpiext_shortfloat_mpifh.h
305+
ompi/mpiext/shortfloat/use-mpi-f08/mpiext_shortfloat_usempif08.h
306+
303307
ompi/tools/mpisync/mpisync
304308
ompi/tools/mpisync/mpirun_prof
305309
ompi/tools/mpisync/ompi_timing_post

ompi/mpi/fortran/common_sym_whitelist.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ ompi_f08_mpi_bxor
1313
ompi_f08_mpi_byte
1414
ompi_f08_mpi_c_bool
1515
ompi_f08_mpi_c_complex
16-
ompi_f08_mpi_count
1716
ompi_f08_mpi_c_double_complex
1817
ompi_f08_mpi_c_float_complex
18+
ompi_f08_mpi_c_long_double_complex
19+
ompi_f08_mpi_c_short_float_complex
1920
ompi_f08_mpi_char
2021
ompi_f08_mpi_character
21-
ompi_f08_mpi_c_long_double_complex
2222
ompi_f08_mpi_comm_null
2323
ompi_f08_mpi_comm_self
2424
ompi_f08_mpi_comm_world
@@ -27,11 +27,13 @@ ompi_f08_mpi_complex16
2727
ompi_f08_mpi_complex32
2828
ompi_f08_mpi_complex4
2929
ompi_f08_mpi_complex8
30+
ompi_f08_mpi_count
3031
ompi_f08_mpi_cxx_bool
3132
ompi_f08_mpi_cxx_complex
3233
ompi_f08_mpi_cxx_double_complex
3334
ompi_f08_mpi_cxx_float_complex
3435
ompi_f08_mpi_cxx_long_double_complex
36+
ompi_f08_mpi_cxx_short_float_complex
3537
ompi_f08_mpi_datatype_null
3638
ompi_f08_mpi_double
3739
ompi_f08_mpi_double_complex
@@ -92,6 +94,7 @@ ompi_f08_mpi_real8
9294
ompi_f08_mpi_replace
9395
ompi_f08_mpi_request_null
9496
ompi_f08_mpi_short
97+
ompi_f08_mpi_short_float
9598
ompi_f08_mpi_short_int
9699
ompi_f08_mpi_signed_char
97100
ompi_f08_mpi_sum

ompi/mpi/fortran/use-mpi-f08/constants.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_win_
6767
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_file_null = {OMPI_MPI_FILE_NULL};
6868

6969
/*
70-
* common block items from ompi/include/mpif-common.h
70+
* common block items from ompi/include/mpif-handles.h
7171
*/
7272
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_aint = {OMPI_MPI_AINT};
7373
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_byte = {OMPI_MPI_BYTE};
@@ -145,3 +145,17 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_
145145
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_count = {OMPI_MPI_COUNT};
146146
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_offset = {OMPI_MPI_OFFSET};
147147
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex4 = {OMPI_MPI_COMPLEX4};
148+
149+
/*
150+
* Handles not defined in ompi/include/mpif-handles.h but defined
151+
* in 'shortfloat' MPI extensions (ompi/mpiext/shortfloat)
152+
*
153+
* OMPI_MPI_* macros are not defined in ompi/include/mpif-values.pl
154+
* because they should not be included in mpif.h. So immediate values
155+
* defined in ompi/datatype/ompi_datatype_module.c are used here.
156+
*/
157+
#if defined(HAVE_SHORT_FLOAT) || defined(HAVE_OPAL_SHORT_FLOAT_T)
158+
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_short_float = {74};
159+
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_short_float_complex = {75};
160+
OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_short_float_complex = {76};
161+
#endif

ompi/mpiext/shortfloat/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
SUBDIRS = c mpif-h use-mpi use-mpi-f08

ompi/mpiext/shortfloat/README.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2+
3+
$COPYRIGHT$
4+
5+
This extension provides additional MPI datatypes MPIX_SHORT_FLOAT,
6+
MPIX_C_SHORT_FLOAT_COMPLEX, and MPIX_CXX_SHORT_FLOAT_COMPLEX, which
7+
are proposed with the MPI_ prefix in June 2017 for proposal in the
8+
MPI 4.0 standard. As of February 2019, it is not accepted yet.
9+
10+
https://github.com/mpi-forum/mpi-issues/issues/65
11+
12+
Each MPI datatype corresponds to the C/C++ type 'short float', the C type
13+
'short float _Complex', and the C++ type 'std::complex<short float>',
14+
respectively.
15+
16+
This extension is enabled only if the C compiler supports 'short float'
17+
or '_Float16', or the '--enable-alt-short-float=TYPE' option is passed
18+
to the configure script.

ompi/mpiext/shortfloat/c/Makefile.am

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
# Convenience libtool library that will be slurped up into libmpi.la.
11+
noinst_LTLIBRARIES = libmpiext_shortfloat_c.la
12+
13+
# This is where the top-level header file (that is included in
14+
# <mpi-ext.h>) must be installed.
15+
ompidir = $(ompiincludedir)/mpiext
16+
17+
# This is the header file that is installed.
18+
ompi_HEADERS = mpiext_shortfloat_c.h
19+
20+
# Sources for the convenience libtool library.
21+
libmpiext_shortfloat_c_la_SOURCES = $(ompi_HEADERS)
22+
libmpiext_shortfloat_c_la_LDFLAGS = -module -avoid-version
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
3+
* $COPYRIGHT$
4+
*
5+
* Additional copyrights may follow
6+
*
7+
* $HEADER$
8+
*
9+
*/
10+
11+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_short_float;
12+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_c_short_float_complex;
13+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_cxx_sfltcplex;
14+
15+
#define MPIX_SHORT_FLOAT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_short_float)
16+
#define MPIX_C_SHORT_FLOAT_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_c_short_float_complex)
17+
#define MPIX_CXX_SHORT_FLOAT_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_sfltcplex)

ompi/mpiext/shortfloat/configure.m4

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
4+
# $COPYRIGHT$
5+
#
6+
# Additional copyrights may follow
7+
#
8+
# $HEADER$
9+
#
10+
11+
# OMPI_MPIEXT_shortfloat_CONFIG([action-if-found], [action-if-not-found])
12+
# -----------------------------------------------------------
13+
AC_DEFUN([OMPI_MPIEXT_shortfloat_CONFIG],[
14+
AC_CONFIG_FILES([
15+
ompi/mpiext/shortfloat/Makefile
16+
ompi/mpiext/shortfloat/c/Makefile
17+
ompi/mpiext/shortfloat/mpif-h/Makefile
18+
ompi/mpiext/shortfloat/use-mpi/Makefile
19+
ompi/mpiext/shortfloat/use-mpi-f08/Makefile
20+
])
21+
22+
AS_IF([{ test "$ENABLE_shortfloat" = "1" || \
23+
test "$ENABLE_EXT_ALL" = "1"; } && \
24+
{ test "$ac_cv_type_short_float" = "yes" || \
25+
test "$ac_cv_type_opal_short_float_t" = "yes"; }],
26+
[$1],
27+
[$2])
28+
])
29+
30+
# The mpi_f08_ext module should not include mpiext_shortfloat_mpifh.h
31+
# because types of a datatype are different between the mpi_ext module
32+
# and the mpi_f08_ext module. The former is integer and the latter is
33+
# type(mpi_datatype).
34+
AC_DEFUN([OMPI_MPIEXT_shortfloat_INCLUDE_MPIFH_IN_USEMPIF08], [0])
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
# Convenience libtool library that will be slurped up into libmpi_mpifh.la.
11+
noinst_LTLIBRARIES =
12+
13+
# Directory where the header file to be included in mpif-ext.h must be
14+
# installed.
15+
ompidir = $(ompiincludedir)/mpiext
16+
17+
# If we are, build the convenience libtool library that will be
18+
# slurped up into libmpi_mpifh.la.
19+
noinst_LTLIBRARIES += libmpiext_shortfloat_mpifh.la
20+
21+
# Just like noinst_LTLIBRARIES, set this macro to empty and
22+
# conditionally add to it later.
23+
ompi_HEADERS =
24+
25+
# Use the Automake conditional to know if we're building the mpif.h
26+
# bindings.
27+
if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
28+
29+
# This is the header file that is installed.
30+
ompi_HEADERS += mpiext_shortfloat_mpifh.h
31+
32+
# Sources for the convenience libtool library.
33+
libmpiext_shortfloat_mpifh_la_SOURCES = $(ompi_HEADERS)
34+
libmpiext_shortfloat_mpifh_la_LDFLAGS = -module -avoid-version
35+
36+
endif
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
! -*- fortran -*-
2+
!
3+
! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
4+
! $COPYRIGHT$
5+
!
6+
! Additional copyrights may follow
7+
!
8+
! $HEADER$
9+
!
10+
11+
integer MPIX_SHORT_FLOAT
12+
integer MPIX_C_SHORT_FLOAT_COMPLEX
13+
integer MPIX_CXX_SHORT_FLOAT_COMPLEX
14+
15+
parameter (MPIX_SHORT_FLOAT=74)
16+
parameter (MPIX_C_SHORT_FLOAT_COMPLEX=75)
17+
parameter (MPIX_CXX_SHORT_FLOAT_COMPLEX=76)

0 commit comments

Comments
 (0)