1
1

Merge pull request #7826 from jsquyres/pr/clang-6-and-7-hate-float16

More carefully test "alternate" short float type in configure
Этот коммит содержится в:
Jeff Squyres 2020-06-17 12:55:37 -04:00 коммит произвёл GitHub
родитель 9af19ab205 2c171718ae
Коммит fcdcb593bb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 43 добавлений и 5 удалений

Просмотреть файл

@ -1,6 +1,7 @@
dnl -*- shell-script -*- dnl -*- shell-script -*-
dnl dnl
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. dnl Copyright (c) 2018-2020 FUJITSU LIMITED. All rights reserved.
dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$ dnl $COPYRIGHT$
dnl dnl
dnl Additional copyrights may follow dnl Additional copyrights may follow
@ -8,10 +9,10 @@ dnl
dnl $HEADER$ dnl $HEADER$
dnl dnl
# Check whether the user wants to use an alternate type of C 'short float'. dnl Check whether the user wants to use an alternate type of C 'short float'.
# OPAL_CHECK_ALT_SHORT_FLOAT dnl OPAL_CHECK_ALT_SHORT_FLOAT
# ------------------------------------------------------------ dnl ------------------------------------------------------------
AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [ AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
AC_CHECK_TYPES(_Float16) AC_CHECK_TYPES(_Float16)
AC_MSG_CHECKING([if want alternate C type of short float]) AC_MSG_CHECKING([if want alternate C type of short float])
@ -35,7 +36,34 @@ AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
fi fi
if test "$opal_short_float_type" != ""; then if test "$opal_short_float_type" != ""; then
AC_MSG_RESULT([yes ($opal_short_float_type)]) AC_MSG_RESULT([yes ($opal_short_float_type)])
AC_CHECK_TYPES($opal_short_float_type, [opal_enable_short_float=1], [opal_enable_short_float=0]) AC_CHECK_TYPES($opal_short_float_type, [opal_alt_short_float_exists=1], [opal_alt_short_float_exists=0])
# Even if the alternate short float type exists, make sure
# that the compiler can actually compile/link when
# mathematical operations are performed on variables of that
# type. Case in point: clang 6.0.x and 7.0.x need an
# additional CLI flag added (--rtlib=compiler-rt) to enable
# software emulation of _Float16. Open MPI will *not*
# automagically add that flag -- we'll just emit a warning and
# point the user to a README where more information is
# available.
AC_MSG_CHECKING([if compiler supports arithmetic operations on $opal_short_float_type])
AS_IF([test $opal_alt_short_float_exists -eq 1],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
static $opal_short_float_type a = 2.5, b = 3.8;
a += b;]])],
[AC_MSG_RESULT([yes])
opal_enable_short_float=1],
[AC_MSG_RESULT([no])
AS_IF([test `basename $CC` = "clang"],
[AC_MSG_WARN([if you are using the Clang 6.0.x or 7.0.x compilers and want])
AC_MSG_WARN([to enable software emulation of half-precision floating point])
AC_MSG_WARN([in conjunction with the "shortfloat" Open MPI extension,])
AC_MSG_WARN([see the ompi/mpiext/shortfloat/README.txt file for details.])
])
opal_enable_short_float=0])
])
if test "$opal_enable_short_float" = 1; then if test "$opal_enable_short_float" = 1; then
AC_DEFINE_UNQUOTED(opal_short_float_t, [[$opal_short_float_type]], AC_DEFINE_UNQUOTED(opal_short_float_t, [[$opal_short_float_type]],
[User-selected alternate C type of short float]) [User-selected alternate C type of short float])

Просмотреть файл

@ -23,3 +23,13 @@ that of MPICH.
This extension is enabled only if the C compiler supports 'short float' This extension is enabled only if the C compiler supports 'short float'
or '_Float16', or the '--enable-alt-short-float=TYPE' option is passed or '_Float16', or the '--enable-alt-short-float=TYPE' option is passed
to the configure script. to the configure script.
NOTE: The Clang 6.0.x and 7.0.x compilers support the "_Float16" type
(via software emulation), but require an additional linker flag to
function properly. If you wish to enable Clang 6.0.x or 7.0.x's
software emulation of _Float16, use the following CLI options to Open
MPI configure script:
./configure \
LDFLAGS=--rtlib=compiler-rt \
--with-wrapper-ldflags=--rtlib=compiler-rt ...