~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-2/comex/m4/comex_blas.m4

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# COMEX_C_BLAS_TEST
 
2
# -----------------
 
3
# Generate C conftest for BLAS.
 
4
AC_DEFUN([COMEX_C_BLAS_TEST], [
 
5
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
 
6
[#ifdef __cplusplus
 
7
extern "C" {
 
8
#endif
 
9
char $caxpy ();
 
10
char $daxpy ();
 
11
char $saxpy ();
 
12
char $zaxpy ();
 
13
#ifdef __cplusplus
 
14
}
 
15
#endif
 
16
],
 
17
[[char cresult =  $caxpy ();
 
18
char dresult =  $daxpy ();
 
19
char sresult =  $saxpy ();
 
20
char zresult =  $zaxpy ();
 
21
]])])
 
22
])
 
23
 
 
24
# COMEX_RUN_BLAS_TEST
 
25
# -------------------
 
26
# Test the linker.
 
27
# Clears BLAS_LIBS on failure.  Sets comex_blas_ok=yes on success.
 
28
# Tests the common case first of using lowercase+underscore. Some libraries,
 
29
# such as ACML, have a C interface which uses lowercase+nounderscore. ComEx
 
30
# assumes it is calling using the Fortran interface.
 
31
AC_DEFUN([COMEX_RUN_BLAS_TEST], [
 
32
    AC_LANG_PUSH([C])
 
33
    comex_blas_ok=no
 
34
    AS_IF([test "x$comex_blas_ok" = xno],
 
35
        [caxpy=caxpy_
 
36
         daxpy=daxpy_
 
37
         saxpy=saxpy_
 
38
         zaxpy=zaxpy_
 
39
         COMEX_C_BLAS_TEST()
 
40
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
41
    AS_IF([test "x$comex_blas_ok" = xno],
 
42
        [caxpy=caxpy__
 
43
         daxpy=daxpy__
 
44
         saxpy=saxpy__
 
45
         zaxpy=zaxpy__
 
46
         COMEX_C_BLAS_TEST()
 
47
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
48
    AS_IF([test "x$comex_blas_ok" = xno],
 
49
        [caxpy=CGEMM
 
50
         daxpy=DGEMM
 
51
         saxpy=SGEMM
 
52
         zaxpy=ZGEMM
 
53
         COMEX_C_BLAS_TEST()
 
54
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
55
    AS_IF([test "x$comex_blas_ok" = xno],
 
56
        [caxpy=CGEMM_
 
57
         daxpy=DGEMM_
 
58
         saxpy=SGEMM_
 
59
         zaxpy=ZGEMM_
 
60
         COMEX_C_BLAS_TEST()
 
61
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
62
    AS_IF([test "x$comex_blas_ok" = xno],
 
63
        [caxpy=CGEMM__
 
64
         daxpy=DGEMM__
 
65
         saxpy=SGEMM__
 
66
         zaxpy=ZGEMM__
 
67
         COMEX_C_BLAS_TEST()
 
68
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
69
    AS_IF([test "x$comex_blas_ok" = xno],
 
70
        [caxpy=caxpy
 
71
         daxpy=daxpy
 
72
         saxpy=saxpy
 
73
         zaxpy=zaxpy
 
74
         COMEX_C_BLAS_TEST()
 
75
         AC_LINK_IFELSE([], [comex_blas_ok=yes], [BLAS_LIBS=])])
 
76
    AS_IF([test "x$comex_blas_ok" = xno],
 
77
        [caxpy=NOTFOUND
 
78
         daxpy=NOTFOUND
 
79
         saxpy=NOTFOUND
 
80
         zaxpy=NOTFOUND])
 
81
    AC_LANG_POP([C])
 
82
])dnl
 
83
 
 
84
# COMEX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
 
85
# -------------------------------------------------
 
86
# Parse the --with-blas argument and test for all *axpy routines. We use
 
87
# different tests depending on whether Fortran sources are enabled. There are
 
88
# many flavors of BLAS that we test for explicitly, although the list could
 
89
# probably be reduced based on currently available systems.
 
90
AC_DEFUN([COMEX_BLAS], [
 
91
blas_size=4
 
92
blas_size_hack=no
 
93
AC_ARG_WITH([blas],
 
94
    [AS_HELP_STRING([--with-blas[[=ARG]]],
 
95
        [use external BLAS library; attempt to detect sizeof(INTEGER)])],
 
96
    [blas_size_hack=yes])
 
97
AC_ARG_WITH([blas4],
 
98
    [AS_HELP_STRING([--with-blas4[[=ARG]]],
 
99
        [use external BLAS library compiled with sizeof(INTEGER)==4])],
 
100
    [blas_size=4; with_blas="$with_blas4"])
 
101
AC_ARG_WITH([blas8],
 
102
    [AS_HELP_STRING([--with-blas8[[=ARG]]],
 
103
        [use external BLAS library compiled with sizeof(INTEGER)==8])],
 
104
    [blas_size=8; with_blas="$with_blas8"])
 
105
 
 
106
comex_blas_ok=no
 
107
AS_IF([test "x$with_blas" = xno], [comex_blas_ok=skip])
 
108
 
 
109
# Parse --with-blas argument. Clear previous values first.
 
110
BLAS_LIBS=
 
111
BLAS_LDFLAGS=
 
112
BLAS_CPPFLAGS=
 
113
COMEX_ARG_PARSE([with_blas], [BLAS_LIBS], [BLAS_LDFLAGS], [BLAS_CPPFLAGS])
 
114
 
 
115
comex_save_LIBS="$LIBS"
 
116
comex_save_LDFLAGS="$LDFLAGS";     LDFLAGS="$BLAS_LDFLAGS $LDFLAGS"
 
117
comex_save_CPPFLAGS="$CPPFLAGS";   CPPFLAGS="$BLAS_CPPFLAGS $CPPFLAGS"
 
118
 
 
119
AC_MSG_NOTICE([Attempting to locate BLAS library])
 
120
 
 
121
# First, check environment/command-line variables.
 
122
# If failed, erase BLAS_LIBS but maintain BLAS_LDFLAGS and BLAS_CPPFLAGS.
 
123
AS_IF([test $comex_blas_ok = no],
 
124
    [AC_MSG_CHECKING([for BLAS with user-supplied flags])
 
125
     LIBS="$BLAS_LIBS $LIBS"
 
126
     COMEX_RUN_BLAS_TEST()
 
127
     LIBS="$comex_save_LIBS"
 
128
     AS_IF([test $comex_blas_ok = yes],
 
129
        [AS_IF([test $blas_size_hack = yes],
 
130
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
 
131
                [*ilp64*],  [blas_size=8],     # Intel MKL
 
132
                [*_int64*], [blas_size=8])])]) # AMD ACML
 
133
     AC_MSG_RESULT([$comex_blas_ok])])
 
134
 
 
135
# AMD Core Math Library (ACML)
 
136
AS_IF([test $comex_blas_ok = no],
 
137
    [AC_MSG_CHECKING([for BLAS in AMD Core Math Library])
 
138
     # add -lacml to BLAS_LIBS if missing from LIBS
 
139
     AS_CASE([$LIBS], [*acml*], [], [BLAS_LIBS="-lacml"])
 
140
     LIBS="$BLAS_LIBS $LIBS"
 
141
     COMEX_RUN_BLAS_TEST()
 
142
     LIBS="$comex_save_LIBS"
 
143
     AS_IF([test "x$comex_blas_ok" = xyes],
 
144
        [AS_IF([test $blas_size_hack = yes],
 
145
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
 
146
                [*_int64*], [blas_size=8])])])
 
147
     AC_MSG_RESULT([$comex_blas_ok])])
 
148
 
 
149
# Intel MKL library
 
150
AS_IF([test $comex_blas_ok = no],
 
151
    [AC_MSG_CHECKING([for BLAS in Intel Math Kernel Library])
 
152
     # add -lmkl to BLAS_LIBS if missing from LIBS
 
153
     AS_CASE([$LIBS], [*mkl*], [], [BLAS_LIBS="-lmkl"])
 
154
     LIBS="$BLAS_LIBS $LIBS"
 
155
     COMEX_RUN_BLAS_TEST()
 
156
     LIBS="$comex_save_LIBS"
 
157
     AS_IF([test "x$comex_blas_ok" = xyes],
 
158
        [AS_IF([test $blas_size_hack = yes],
 
159
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
 
160
                [*ilp64*], [blas_size=8])])])
 
161
     AC_MSG_RESULT([$comex_blas_ok])])
 
162
 
 
163
# ATLAS library (http://math-atlas.sourceforge.net/)
 
164
AS_IF([test $comex_blas_ok = no],
 
165
    [AC_MSG_CHECKING([for BLAS in ATLAS])
 
166
     AS_IF([test "x$enable_f77" = xno],
 
167
        [# add -lcblas if needed but missing from LIBS
 
168
         AS_CASE([$LIBS], [*cblas*], [], [BLAS_LIBS="-lcblas"])],
 
169
        [# add -lf77blas if needed but missing from LIBS
 
170
         AS_CASE([$LIBS], [*f77blas*], [], [BLAS_LIBS="-lf77blas"])])
 
171
     # add -latlas if needed but missing from LIBS
 
172
     AS_CASE([$LIBS], [*atlas*], [], [BLAS_LIBS="$BLAS_LIBS -latlas"])
 
173
     LIBS="$BLAS_LIBS $LIBS"
 
174
     COMEX_RUN_BLAS_TEST()
 
175
     LIBS="$comex_save_LIBS"
 
176
     AC_MSG_RESULT([$comex_blas_ok])])
 
177
 
 
178
# PhiPACK libraries (requires generic BLAS lib, too)
 
179
AS_IF([test $comex_blas_ok = no],
 
180
    [AC_MSG_CHECKING([for BLAS in PhiPACK libraries])
 
181
     # add -lblas to BLAS_LIBS if missing from LIBS
 
182
     AS_CASE([$LIBS], [*blas*], [], [BLAS_LIBS="-lblas"])
 
183
     # add -ldgemm to BLAS_LIBS if missing from LIBS
 
184
     AS_CASE([$LIBS], [*dgemm*], [], [BLAS_LIBS="-ldgemm $BLAS_LIBS"])
 
185
     # add -lsgemm to BLAS_LIBS if missing from LIBS
 
186
     AS_CASE([$LIBS], [*sgemm*], [], [BLAS_LIBS="-lsgemm $BLAS_LIBS"])
 
187
     LIBS="$BLAS_LIBS $LIBS"
 
188
     COMEX_RUN_BLAS_TEST()
 
189
     LIBS="$comex_save_LIBS"
 
190
     AC_MSG_RESULT([$comex_blas_ok])])
 
191
 
 
192
# Apple Accelerate.framework
 
193
AS_IF([test $comex_blas_ok = no],
 
194
    [AC_MSG_CHECKING([for BLAS in Apple Accelerate.framework])
 
195
     # add -framework Accelerate to BLAS_LIBS if missing from LIBS
 
196
     AS_CASE([$LIBS], [*Accelerate*], [], [BLAS_LIBS="-framework Accelerate"])
 
197
     LIBS="$BLAS_LIBS $LIBS"
 
198
     COMEX_RUN_BLAS_TEST()
 
199
     LIBS="$comex_save_LIBS"
 
200
     AC_MSG_RESULT([$comex_blas_ok])])
 
201
 
 
202
# Apple vecLib.framework
 
203
AS_IF([test $comex_blas_ok = no],
 
204
    [AC_MSG_CHECKING([for BLAS in Apple vecLib.framework])
 
205
     # add -framework vecLib to BLAS_LIBS if missing from LIBS
 
206
     AS_CASE([$LIBS], [*vecLib*], [], [BLAS_LIBS="-framework vecLib"])
 
207
     LIBS="$BLAS_LIBS $LIBS"
 
208
     COMEX_RUN_BLAS_TEST()
 
209
     LIBS="$comex_save_LIBS"
 
210
     AC_MSG_RESULT([$comex_blas_ok])])
 
211
 
 
212
# Alpha CXML library (CXML stands for Compaq Extended Math Library)
 
213
AS_IF([test $comex_blas_ok = no],
 
214
    [AC_MSG_CHECKING([for BLAS in Alpha CXML library])
 
215
     # add -lcxml to BLAS_LIBS if missing from LIBS
 
216
     AS_CASE([$LIBS], [*cxml*], [], [BLAS_LIBS="-lcxml"])
 
217
     LIBS="$BLAS_LIBS $LIBS"
 
218
     COMEX_RUN_BLAS_TEST()
 
219
     LIBS="$comex_save_LIBS"
 
220
     AS_IF([test $comex_blas_ok = no],
 
221
        [# add -lcxml to BLAS_LIBS if missing from LIBS
 
222
         AS_CASE([$LIBS], [*cxml*], [], [BLAS_LIBS="-lcxml"])
 
223
         # add -lcpml to BLAS_LIBS if missing from LIBS
 
224
         AS_CASE([$LIBS], [*cpml*], [], [BLAS_LIBS="$BLAS_LIBS -lcpml"])
 
225
         LIBS="$BLAS_LIBS $LIBS"
 
226
         COMEX_RUN_BLAS_TEST()
 
227
         LIBS="$comex_save_LIBS"])
 
228
     AC_MSG_RESULT([$comex_blas_ok])])
 
229
 
 
230
# Alpha DXML library (now called CXML, see above)
 
231
 
 
232
# Sun Performance library
 
233
AS_IF([test $comex_blas_ok = no],
 
234
    [AC_MSG_CHECKING([for BLAS in Sun Performance Library])
 
235
     # add -xlic_lib=sunperf to BLAS_LIBS if missing from LIBS
 
236
     AS_CASE([$LIBS], [*sunperf*], [], [BLAS_LIBS="-xlic_lib=sunperf"])
 
237
     LIBS="$BLAS_LIBS $LIBS"
 
238
     COMEX_RUN_BLAS_TEST()
 
239
     LIBS="$comex_save_LIBS"
 
240
     AS_IF([test $comex_blas_ok = no],
 
241
        [# add -xlic_lib=sunperf to BLAS_LIBS if missing from LIBS
 
242
         AS_CASE([$LIBS], [*sunperf*], [], [BLAS_LIBS="-xlic_lib=sunperf"])
 
243
         # add -lsunmath to BLAS_LIBS if missing from LIBS
 
244
         AS_CASE([$LIBS], [*sunmath*], [], [BLAS_LIBS="$BLAS_LIBS -lsunmath"])
 
245
         LIBS="$BLAS_LIBS $LIBS"
 
246
         COMEX_RUN_BLAS_TEST()
 
247
         LIBS="$comex_save_LIBS"])
 
248
     AC_MSG_RESULT([$comex_blas_ok])])
 
249
 
 
250
# SCSL library (SCSL stands for SGI/Cray Scientific Library)
 
251
AS_IF([test $comex_blas_ok = no],
 
252
    [AC_MSG_CHECKING([for BLAS in SGI/Cray Scientific Library])
 
253
     # add -lscs to BLAS_LIBS if missing from LIBS
 
254
     AS_CASE([$LIBS], [*scs*], [], [BLAS_LIBS="-lscs"])
 
255
     LIBS="$BLAS_LIBS $LIBS"
 
256
     COMEX_RUN_BLAS_TEST()
 
257
     LIBS="$comex_save_LIBS"
 
258
     AC_MSG_RESULT([$comex_blas_ok])])
 
259
 
 
260
# SGIMATH library
 
261
AS_IF([test $comex_blas_ok = no],
 
262
    [AC_MSG_CHECKING([for BLAS in SGIMATH library])
 
263
     # add -lcomplib.sgimath to BLAS_LIBS if missing from LIBS
 
264
     AS_CASE([$LIBS], [*complib.sgimath*], [], [BLAS_LIBS="-lcomplib.sgimath"])
 
265
     LIBS="$BLAS_LIBS $LIBS"
 
266
     COMEX_RUN_BLAS_TEST()
 
267
     LIBS="$comex_save_LIBS"
 
268
     AC_MSG_RESULT([$comex_blas_ok])])
 
269
 
 
270
# IBM ESSL library (requires generic BLAS lib, too)
 
271
AS_IF([test $comex_blas_ok = no],
 
272
    [AC_MSG_CHECKING([for BLAS in IBM ESSL library])
 
273
     # add -lessl to BLAS_LIBS if missing from LIBS
 
274
     AS_CASE([$LIBS], [*essl*], [], [BLAS_LIBS="-lessl"])
 
275
     # add -lblas to BLAS_LIBS if missing from LIBS
 
276
     AS_CASE([$LIBS], [*blas*], [], [BLAS_LIBS="$BLAS_LIBS -lblas"])
 
277
     LIBS="$BLAS_LIBS $LIBS"
 
278
     COMEX_RUN_BLAS_TEST()
 
279
     LIBS="$comex_save_LIBS"
 
280
     AC_MSG_RESULT([$comex_blas_ok])])
 
281
 
 
282
# Generic BLAS library
 
283
AS_IF([test $comex_blas_ok = no],
 
284
    [AC_MSG_CHECKING([for BLAS in generic library])
 
285
     BLAS_LIBS="-lblas"
 
286
     LIBS="$BLAS_LIBS $LIBS"
 
287
     COMEX_RUN_BLAS_TEST()
 
288
     LIBS="$comex_save_LIBS"
 
289
     AC_MSG_RESULT([$comex_blas_ok])])
 
290
 
 
291
CPPFLAGS="$comex_save_CPPFLAGS"
 
292
LDFLAGS="$comex_save_LDFLAGS"
 
293
 
 
294
AC_SUBST([BLAS_LIBS])
 
295
AC_SUBST([BLAS_LDFLAGS])
 
296
AC_SUBST([BLAS_CPPFLAGS])
 
297
 
 
298
# Tests are complete. Execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 
299
AS_IF([test $comex_blas_ok = yes],
 
300
    [have_blas=1
 
301
     $1],
 
302
    [AC_MSG_WARN([BLAS library not found, using internal BLAS])
 
303
     blas_size=4
 
304
     have_blas=0
 
305
     $2])
 
306
AC_DEFINE_UNQUOTED([HAVE_BLAS], [$have_blas],
 
307
    [Define to 1 if using external BLAS library])
 
308
AC_DEFINE_UNQUOTED([BLAS_SIZE], [$blas_size],
 
309
    [Define to sizeof(INTEGER) used to compile BLAS])
 
310
AC_DEFINE_UNQUOTED([BLAS_CAXPY], [$caxpy],
 
311
    [Define to name of caxpy routine to call from C])
 
312
AC_DEFINE_UNQUOTED([BLAS_DAXPY], [$daxpy],
 
313
    [Define to name of daxpy routine to call from C])
 
314
AC_DEFINE_UNQUOTED([BLAS_SAXPY], [$saxpy],
 
315
    [Define to name of saxpy routine to call from C])
 
316
AC_DEFINE_UNQUOTED([BLAS_ZAXPY], [$zaxpy],
 
317
    [Define to name of zaxpy routine to call from C])
 
318
AM_CONDITIONAL([HAVE_BLAS], [test $comex_blas_ok = yes])
 
319
])dnl COMEX_BLAS