1
1
dnl -* - shell-script -* -
2
2
dnl
3
- dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
3
+ dnl Copyright (c) 2018-2020 FUJITSU LIMITED. All rights reserved.
4
+ dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
4
5
dnl $COPYRIGHT $
5
6
dnl
6
7
dnl Additional copyrights may follow
7
8
dnl
8
9
dnl $HEADER $
9
10
dnl
10
11
11
- # Check whether the user wants to use an alternate type of C 'short float'.
12
+ dnl Check whether the user wants to use an alternate type of C ' short float' .
12
13
13
- # OPAL_CHECK_ALT_SHORT_FLOAT
14
- # ------------------------------------------------------------
14
+ dnl OPAL_CHECK_ALT_SHORT_FLOAT
15
+ dnl ------------------------------------------------------------
15
16
AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
16
17
AC_CHECK_TYPES(_Float16)
17
18
AC_MSG_CHECKING([if want alternate C type of short float])
@@ -35,7 +36,34 @@ AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
35
36
fi
36
37
if test " $opal_short_float_type " ! = " " ; then
37
38
AC_MSG_RESULT([yes ($opal_short_float_type )])
38
- AC_CHECK_TYPES($opal_short_float_type , [opal_enable_short_float= 1], [opal_enable_short_float= 0])
39
+ AC_CHECK_TYPES($opal_short_float_type , [opal_alt_short_float_exists= 1], [opal_alt_short_float_exists= 0])
40
+
41
+ # Even if the alternate short float type exists, make sure
42
+ # that the compiler can actually compile/link when
43
+ # mathematical operations are performed on variables of that
44
+ # type. Case in point: clang 6.0.x and 7.0.x need an
45
+ # additional CLI flag added (--rtlib=compiler-rt) to enable
46
+ # software emulation of _Float16. Open MPI will *not*
47
+ # automagically add that flag -- we'll just emit a warning and
48
+ # point the user to a README where more information is
49
+ # available.
50
+ AC_MSG_CHECKING([if compiler supports arithmetic operations on $opal_short_float_type ])
51
+ AS_IF([test $opal_alt_short_float_exists -eq 1],
52
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
53
+ static $opal_short_float_type a = 2.5, b = 3.8;
54
+ a += b; ]])],
55
+ [AC_MSG_RESULT([yes])
56
+ opal_enable_short_float= 1],
57
+ [AC_MSG_RESULT([no])
58
+ AS_IF([test ` basename $CC ` = " clang" ],
59
+ [AC_MSG_WARN([if you are using the Clang 6.0.x or 7.0.x compilers and want])
60
+ AC_MSG_WARN([to enable software emulation of half-precision floating point])
61
+ AC_MSG_WARN([in conjunction with the " shortfloat" Open MPI extension,])
62
+ AC_MSG_WARN([see the ompi/mpiext/shortfloat/README.txt file for details.])
63
+ ])
64
+ opal_enable_short_float= 0])
65
+ ])
66
+
39
67
if test " $opal_enable_short_float " = 1; then
40
68
AC_DEFINE_UNQUOTED(opal_short_float_t, [[$opal_short_float_type ]],
41
69
[User-selected alternate C type of short float])
0 commit comments