Skip to content

Commit 37e1204

Browse files
authored
Merge pull request #13245 from bosilca/topic/4.1/add_support_for_LLVM19
Bring better Fortran TKR support in 4.1
2 parents 9da3e12 + a189f1f commit 37e1204

File tree

3 files changed

+54
-19
lines changed

3 files changed

+54
-19
lines changed

config/ompi_fortran_check_asynchronous.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2024 Research Organization for Information Science
15+
dnl and Technology (RIST). All rights reserved.
1416
dnl $COPYRIGHT$
1517
dnl
1618
dnl Additional copyrights may follow
@@ -35,6 +37,10 @@ SUBROUTINE binky(buf)
3537
REAL, DIMENSION(*), ASYNCHRONOUS :: buf
3638
END SUBROUTINE
3739
END INTERFACE
40+
CONTAINS
41+
SUBROUTINE wookie(buf)
42+
REAL, DIMENSION(*), ASYNCHRONOUS :: buf
43+
END SUBROUTINE
3844
END MODULE asynch_mod]])],
3945
[AS_VAR_SET(asynchronous_var, yes)],
4046
[AS_VAR_SET(asynchronous_var, no)])

config/ompi_fortran_check_bind_c.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2020 Research Organization for Information Science
15+
dnl and Technology (RIST). All rights reserved.
1416
dnl $COPYRIGHT$
1517
dnl
1618
dnl Additional copyrights may follow
@@ -83,6 +85,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_BIND_C_TYPE],[
8385
end module]])],
8486
[AS_VAR_SET(bind_c_type_var, yes)],
8587
[AS_VAR_SET(bind_c_type_var, no)])
88+
rm -rf *.mod 2>/dev/null
8689
AC_LANG_POP([Fortran])
8790
])
8891

config/ompi_fortran_check_ignore_tkr.m4

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
1414
dnl reserved.
1515
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
1616
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
17+
dnl Copyright (c) 2024 Research Organization for Information Science
18+
dnl and Technology (RIST). All rights reserved.
1719
dnl $COPYRIGHT$
1820
dnl
1921
dnl Additional copyrights may follow
@@ -23,7 +25,7 @@ dnl $HEADER$
2325
# Does this compiler support (void*)-like functionality for MPI choice
2426
# buffers? If so, which flavor?
2527
AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR], [
26-
OPAL_VAR_SCOPE_PUSH([result happy type predecl])
28+
OPAL_VAR_SCOPE_PUSH([result ignore_tkr_happy type predecl])
2729

2830
OMPI_FORTRAN_IGNORE_TKR_PREDECL=
2931
OMPI_FORTRAN_IGNORE_TKR_TYPE=
@@ -41,11 +43,11 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR], [
4143
AS_VAR_COPY([result], [fortran_ignore_tkr_data])
4244

4345
# Parse the result
44-
happy=`echo $result | cut -d: -f1`
46+
ignore_tkr_happy=`echo $result | cut -d: -f1`
4547
type=`echo $result | cut -d: -f2`
4648
predecl=`echo $result | cut -d: -f3-`
4749

48-
AS_IF([test $happy -eq 1],
50+
AS_IF([test $ignore_tkr_happy -eq 1],
4951
[OMPI_FORTRAN_IGNORE_TKR_PREDECL=$predecl
5052
OMPI_FORTRAN_IGNORE_TKR_TYPE=$type
5153
$1],
@@ -58,7 +60,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR], [
5860
################
5961

6062
AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
61-
OPAL_VAR_SCOPE_PUSH([happy ompi_fortran_ignore_tkr_predecl ompi_fortran_ignore_tkr_type])
63+
OPAL_VAR_SCOPE_PUSH([internal_ignore_tkr_happy ompi_fortran_ignore_tkr_predecl ompi_fortran_ignore_tkr_type])
6264

6365
# If we were called here, it means that the value was not cached,
6466
# so we need to check several different things. Since CACHE_CHECK
@@ -74,43 +76,49 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
7476
OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
7577
[!], [type(*)],
7678
[TYPE(*), DIMENSION(*)],
77-
[happy=1], [happy=0])
79+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])
7880

7981
# GCC compilers
80-
AS_IF([test $happy -eq 0],
82+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
8183
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
8284
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],
8385
[!GCC\$ ATTRIBUTES NO_ARG_CHECK],
84-
[happy=1], [happy=0])])
86+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
87+
# LLVM compilers
88+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
89+
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
90+
[!DIR\$ IGNORE_TKR], [type(*)],
91+
[!DIR\$ IGNORE_TKR],
92+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
8593
# Intel compilers
86-
AS_IF([test $happy -eq 0],
94+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
8795
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
8896
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],
8997
[!DEC\$ ATTRIBUTES NO_ARG_CHECK],
90-
[happy=1], [happy=0])])
98+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
9199
# Solaris Studio compilers
92100
# Note that due to a compiler bug, we have been advised by Oracle to
93101
# use the "character(*)" type
94-
AS_IF([test $happy -eq 0],
102+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
95103
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
96104
[!\$PRAGMA IGNORE_TKR], [character(*)],
97105
[!\$PRAGMA IGNORE_TKR],
98-
[happy=1], [happy=0])])
106+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
99107
# Cray compilers
100-
AS_IF([test $happy -eq 0],
108+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
101109
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
102110
[!DIR\$ IGNORE_TKR], [real, dimension(*)],
103111
[!DIR\$ IGNORE_TKR],
104-
[happy=1], [happy=0])])
112+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
105113
# IBM compilers
106-
AS_IF([test $happy -eq 0],
114+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
107115
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
108116
[!IBM* IGNORE_TKR], [real, dimension(*)],
109117
[!IBM* IGNORE_TKR],
110-
[happy=1], [happy=0])])
118+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
111119

112120
AS_VAR_SET(fortran_ignore_tkr_data,
113-
[${happy}:${ompi_fortran_ignore_tkr_type}:${ompi_fortran_ignore_tkr_predecl}])
121+
[${internal_ignore_tkr_happy}:${ompi_fortran_ignore_tkr_type}:${ompi_fortran_ignore_tkr_predecl}])
114122

115123
# Now put the original CACHE_CHECK MSG_CHECKING back so that it can
116124
# output the MSG_RESULT.
@@ -133,6 +141,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
133141
AC_MSG_CHECKING([for Fortran compiler support of $3])
134142
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[!
135143
! Autoconf puts "program main" at the top
144+
implicit none
136145

137146
interface
138147
subroutine force_assumed_shape(a, count)
@@ -141,7 +150,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
141150
end subroutine force_assumed_shape
142151
end interface
143152

144-
interface foo
153+
interface
145154
subroutine foo(buffer, count)
146155
$1 buffer
147156
$2, intent(in) :: buffer
@@ -157,6 +166,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
157166
complex, pointer, dimension(:,:) :: ptr
158167
target :: buffer3
159168
integer :: buffer4
169+
integer :: a
160170
ptr => buffer3
161171

162172
! Set some known values (somewhat irrelevant for this test, but just be
@@ -189,8 +199,23 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
189199
call foo(a, count)
190200
end subroutine force_assumed_shape
191201

202+
module check_ignore_tkr
203+
interface foobar
204+
subroutine foobar_x(buffer, count)
205+
$1 buffer
206+
$2, intent(in) :: buffer
207+
integer, intent(in) :: count
208+
end subroutine foobar_x
209+
end interface
210+
end module
211+
212+
subroutine bar(var)
213+
use check_ignore_tkr
214+
implicit none
215+
real, intent(inout) :: var(:, :, :)
216+
217+
call foobar(var(1,1,1), 1)
192218
! Autoconf puts "end" after the last line
193-
subroutine bogus
194219
]]),
195220
[msg=yes
196221
ompi_fortran_ignore_tkr_predecl="$1"
@@ -199,7 +224,8 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
199224
[msg=no
200225
$5])
201226
AC_MSG_RESULT($msg)
227+
# Make sure to clean up any generated *.mod files
228+
rm -rf *.mod 2>/dev/null
202229
AC_LANG_POP([Fortran])
203230
OPAL_VAR_SCOPE_POP
204231
])
205-

0 commit comments

Comments
 (0)