-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jsquyres/topic/fortran-sizeof-fixes
fortran: fix the MPI_SIZEOF problems in the Fortran interfaces RM-approved
- Loading branch information
Showing
24 changed files
with
834 additions
and
1,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
dnl -*- shell-script -*- | ||
dnl | ||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
dnl University Research and Technology | ||
dnl Corporation. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University | ||
dnl of Tennessee Research Foundation. All rights | ||
dnl reserved. | ||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
dnl University of Stuttgart. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The Regents of the University of California. | ||
dnl All rights reserved. | ||
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. | ||
dnl $COPYRIGHT$ | ||
dnl | ||
dnl Additional copyrights may follow | ||
dnl | ||
dnl $HEADER$ | ||
dnl | ||
|
||
# Check whether or not the Fortran compiler supports the "interface" | ||
# keyword or not. | ||
|
||
# OMPI_FORTRAN_CHECK_INTERFACE([action if found], | ||
# [action if not found]) | ||
# ---------------------------------------------------- | ||
AC_DEFUN([OMPI_FORTRAN_CHECK_INTERFACE],[ | ||
AS_VAR_PUSHDEF([interface_var], [ompi_cv_fortran_interface]) | ||
|
||
AC_CACHE_CHECK([if Fortran compiler supports INTERFACE], interface_var, | ||
[AC_LANG_PUSH([Fortran]) | ||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[MODULE my_module | ||
INTERFACE MPI_Foo | ||
SUBROUTINE inky(a) | ||
DOUBLE PRECISION A | ||
END SUBROUTINE inky | ||
SUBROUTINE blinky(a) | ||
INTEGER A | ||
END SUBROUTINE blinky | ||
END INTERFACE MPI_Foo | ||
END MODULE my_module]])], | ||
[AS_VAR_SET(interface_var, yes)], | ||
[AS_VAR_SET(interface_var, no)]) | ||
touch conftest_foo.mod | ||
rm -rf *.mod 2>/dev/null | ||
AC_LANG_POP([Fortran]) | ||
]) | ||
|
||
AS_VAR_IF(interface_var, [yes], [$1], [$2]) | ||
AS_VAR_POPDEF([interface_var])dnl | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
dnl -*- shell-script -*- | ||
dnl | ||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
dnl University Research and Technology | ||
dnl Corporation. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University | ||
dnl of Tennessee Research Foundation. All rights | ||
dnl reserved. | ||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
dnl University of Stuttgart. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The Regents of the University of California. | ||
dnl All rights reserved. | ||
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. | ||
dnl $COPYRIGHT$ | ||
dnl | ||
dnl Additional copyrights may follow | ||
dnl | ||
dnl $HEADER$ | ||
dnl | ||
|
||
# Check whether or not the Fortran compiler supports iso_fortran_env or not | ||
# | ||
# OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV([action if found], [action if not found]) | ||
# ---------------------------------------------------- | ||
AC_DEFUN([OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV],[ | ||
AS_VAR_PUSHDEF([iso_fortran_env_var], [ompi_cv_fortran_have_iso_fortran_env]) | ||
|
||
AC_CACHE_CHECK([if Fortran compiler supports ISO_FORTRAN_ENV], iso_fortran_env_var, | ||
[AC_LANG_PUSH([Fortran]) | ||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_iso_fortran_env | ||
use, intrinsic :: iso_fortran_env | ||
real(real32) :: var | ||
var = 12.34 | ||
end program]])], | ||
[AS_VAR_SET(iso_fortran_env_var, yes)], | ||
[AS_VAR_SET(iso_fortran_env_var, no)]) | ||
AC_LANG_POP([Fortran]) | ||
]) | ||
|
||
AS_VAR_IF(iso_fortran_env_var, [yes], [$1], [$2]) | ||
AS_VAR_POPDEF([iso_fortran_env_var]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
dnl -*- shell-script -*- | ||
dnl | ||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
dnl University Research and Technology | ||
dnl Corporation. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University | ||
dnl of Tennessee Research Foundation. All rights | ||
dnl reserved. | ||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
dnl University of Stuttgart. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The Regents of the University of California. | ||
dnl All rights reserved. | ||
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. | ||
dnl $COPYRIGHT$ | ||
dnl | ||
dnl Additional copyrights may follow | ||
dnl | ||
dnl $HEADER$ | ||
dnl | ||
|
||
# Check the max array rank that the Fortran compiler supports. | ||
# | ||
# OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK | ||
# | ||
# Sets $OMPI_FORTRAN_MAX_ARRAY_RANK, AC_SUBSTs it, and AC_DEFINEs | ||
# OMPI_FORTRAN_MAX_ARRAY_RANK. | ||
# ---------------------------------------------------- | ||
AC_DEFUN([OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK],[ | ||
AS_VAR_PUSHDEF([max_array_rank_var], [ompi_cv_fortran_max_array_rank]) | ||
|
||
OPAL_VAR_SCOPE_PUSH([f_max_rank f_fail f_rank f_i f_dim]) | ||
AC_CACHE_CHECK([max supported Fortran array rank], max_array_rank_var, | ||
[AC_LANG_PUSH([Fortran]) | ||
f_max_rank=0 | ||
f_fail=0 | ||
|
||
# Realistically, this will only be 7 or 15. But what the heck | ||
# -- try them all. Note that we don't test above 15, because | ||
# that's the max value from the F2008 spec (and some compilers | ||
# will let you go above rank=16, e.g., Intel ifort). | ||
for f_rank in 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do | ||
if test $f_fail -eq 0; then | ||
f_i=1 | ||
f_dim=2 | ||
while test `expr $f_i + 1` -le $f_rank; do | ||
f_dim="$f_dim,2" | ||
f_i=`expr $f_i + 1` | ||
done | ||
OPAL_LOG_MSG([testing Fortran dimension $f_rank / $f_dim]) | ||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[PROGRAM test_program | ||
INTEGER, DIMENSION($f_dim) :: var | ||
var($f_dim) = 3 | ||
END PROGRAM test_program]])], | ||
[f_max_rank=$f_rank], [f_fail=1]) | ||
fi | ||
done | ||
AS_VAR_SET(max_array_rank_var, $f_max_rank) | ||
AC_LANG_POP([Fortran]) | ||
]) | ||
|
||
AS_VAR_COPY([OMPI_FORTRAN_MAX_ARRAY_RANK], [max_array_rank_var]) | ||
AC_SUBST(OMPI_FORTRAN_MAX_ARRAY_RANK) | ||
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_MAX_ARRAY_RANK], | ||
[$OMPI_FORTRAN_MAX_ARRAY_RANK], | ||
[Max dimension rank of Fortran arrays]) | ||
|
||
OPAL_VAR_SCOPE_POP | ||
AS_VAR_POPDEF([max_array_rank_var])dnl | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
dnl -*- shell-script -*- | ||
dnl | ||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
dnl University Research and Technology | ||
dnl Corporation. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University | ||
dnl of Tennessee Research Foundation. All rights | ||
dnl reserved. | ||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
dnl University of Stuttgart. All rights reserved. | ||
dnl Copyright (c) 2004-2005 The Regents of the University of California. | ||
dnl All rights reserved. | ||
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. | ||
dnl $COPYRIGHT$ | ||
dnl | ||
dnl Additional copyrights may follow | ||
dnl | ||
dnl $HEADER$ | ||
dnl | ||
|
||
# Check whether or not the Fortran compiler supports storage_size() | ||
# for all relevant types or not. E.g., gfortran 4.8 supports | ||
# storage_size() on some types, not but all. | ||
# | ||
# OMPI_FORTRAN_CHECK_STORAGE_SIZE([action if found], [action if not found]) | ||
# ---------------------------------------------------- | ||
AC_DEFUN([OMPI_FORTRAN_CHECK_STORAGE_SIZE],[ | ||
AS_VAR_PUSHDEF([fortran_storage_size_var], [ompi_cv_fortran_have_storage_size]) | ||
|
||
AC_CACHE_CHECK([if Fortran compiler supports STORAGE_SIZE for relevant types], | ||
fortran_storage_size_var, | ||
[AC_LANG_PUSH([Fortran]) | ||
AC_LINK_IFELSE([AC_LANG_SOURCE([[program check_for_storage_size | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32, INT32 | ||
integer size | ||
complex(real32) :: c32 | ||
complex(real32), dimension(5) :: c32_array | ||
real(real32) :: r32 | ||
real(real32), dimension(5) :: r32_array | ||
integer(int32) :: i32 | ||
integer(int32), dimension(5) :: i32_array | ||
|
||
call storage_size_complex32_scalar(c32, size) | ||
call storage_size_complex32_r1(c32_array, size) | ||
call storage_size_int32_scalar(i32, size) | ||
call storage_size_int32_r1(i32_array, size) | ||
call storage_size_real32_scalar(r32, size) | ||
call storage_size_real32_r1(r32_array, size) | ||
end program | ||
|
||
SUBROUTINE storage_size_complex32_scalar(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32 | ||
COMPLEX(REAL32) ::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_complex32_scalar | ||
|
||
SUBROUTINE storage_size_complex32_r1(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32 | ||
COMPLEX(REAL32), DIMENSION(*)::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_complex32_r1 | ||
|
||
SUBROUTINE storage_size_int32_scalar(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: INT32 | ||
INTEGER(INT32) ::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_int32_scalar | ||
|
||
SUBROUTINE storage_size_int32_r1(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: INT32 | ||
INTEGER(INT32), DIMENSION(*)::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_int32_r1 | ||
|
||
SUBROUTINE storage_size_real32_scalar(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32 | ||
REAL(REAL32) ::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_real32_scalar | ||
|
||
SUBROUTINE storage_size_real32_r1(x, size) | ||
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32 | ||
REAL(REAL32), DIMENSION(*)::x | ||
INTEGER, INTENT(OUT) :: size | ||
|
||
size = storage_size(x) / 8 | ||
END SUBROUTINE storage_size_real32_r1 | ||
]])], | ||
[AS_VAR_SET(fortran_storage_size_var, yes)], | ||
[AS_VAR_SET(fortran_storage_size_var, no)]) | ||
AC_LANG_POP([Fortran]) | ||
]) | ||
|
||
AS_VAR_IF(fortran_storage_size_var, [yes], [$1], [$2]) | ||
AS_VAR_POPDEF([fortran_storage_size_var]) | ||
]) |
Oops, something went wrong.