File: ompi_fortran_check_max_array_rank.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (69 lines) | stat: -rw-r--r-- 2,777 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
])