Skip to content

Commit efcce48

Browse files
committed
configure/f08: check ignore_tkr(d)
nvfortran -cuda supports "device" attribute that require precise matching in generic interface. Add "!DIR$ IGNORE_TKR(d) buf" ignores this check.
1 parent e986d97 commit efcce48

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

confdb/aclocal_fc.m4

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,44 @@ AC_DEFUN([PAC_FC_CHECK_IGNORE_TKR],[
12681268
AC_LANG_POP(Fortran)
12691269
])
12701270

1271+
dnl
1272+
dnl PAC_FC_CHECK_IGNORE_TKR_D check directives to ignore "DEVICE" attribute.
1273+
dnl set pac_fc_ignore_tkr_d to a type if supported, otherwise, no.
1274+
dnl
1275+
AC_DEFUN([PAC_FC_CHECK_IGNORE_TKR_D],[
1276+
AC_LANG_PUSH(Fortran)
1277+
AC_MSG_CHECKING([directives for Fortran compiler to ignore TKR(d) check])
1278+
pac_fc_ignore_tkr_d=no
1279+
for a in dir ; do
1280+
case $a in
1281+
dir)
1282+
# flang
1283+
decl='!DIR$ IGNORE_TKR(d) buf'
1284+
;;
1285+
esac
1286+
1287+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1288+
program main
1289+
IMPLICIT NONE
1290+
INTERFACE
1291+
SUBROUTINE FUNC_A(buf)
1292+
TYPE(*), DIMENSION(..) :: buf
1293+
$decl
1294+
END SUBROUTINE
1295+
END INTERFACE
1296+
1297+
REAL A(10)
1298+
CALL FUNC_A(A)
1299+
end
1300+
])],[pac_fc_ignore_tkr_d=$a],[])
1301+
if test $pac_fc_ignore_tkr_d != no ; then
1302+
break
1303+
fi
1304+
done
1305+
AC_MSG_RESULT([$pac_fc_ignore_tkr_d])
1306+
AC_LANG_POP(Fortran)
1307+
])
1308+
12711309
dnl
12721310
dnl PAC_FC_ISO_C_BINDING check whether ISO_C_BINDING is supported.
12731311
dnl set pac_fc_iso_c_binding to yes if it's supported, otherwise, no.

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,6 +4207,7 @@ fi
42074207

42084208
if test "$enable_f08" = "yes" ; then
42094209
PAC_FC_CHECK_REAL128
4210+
PAC_FC_CHECK_IGNORE_TKR_D
42104211
if test -z "$PYTHON" ; then
42114212
if test -f src/binding/fortran/use_mpi_f08/mpi_f08.f90 ; then
42124213
AC_MSG_NOTICE([Using pre-generated Fortran mpi_f08 binding source. To prevent issues, install Python 3 and rerun configure.])
@@ -4218,6 +4219,9 @@ if test "$enable_f08" = "yes" ; then
42184219
if test "$pac_fc_has_real128" = "no" ; then
42194220
cmd_f08="$cmd_f08 -no-real128"
42204221
fi
4222+
if test "$pac_fc_ignore_tkr_d" != "no" ; then
4223+
cmd_f08="$cmd_f08 -ignore-tkr-d=$pac_fc_ignore_tkr_d"
4224+
fi
42214225
if test "$enable_romio" = "no" ; then
42224226
cmd_f08="$cmd_f08 -no-mpiio"
42234227
fi

0 commit comments

Comments
 (0)