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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/m4/ga_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
 
# GA_F77_BLAS_TEST
2
 
# ----------------
3
 
# Generate Fortran 77 conftest for BLAS.
4
 
AC_DEFUN([GA_F77_BLAS_TEST], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([],
5
 
[[      implicit none
6
 
      INTEGER M, N, K, LDA, LDB, LDC
7
 
      COMPLEX CA(20,40), CB(20,30), CC(40,30), Calpha, Cbeta
8
 
      DOUBLE COMPLEX ZA(20,40), ZB(20,30), ZC(40,30), Zalpha, Zbeta
9
 
      REAL SA(20,40), SB(20,30), SC(40,30), Salpha, Sbeta
10
 
      DOUBLE PRECISION DA(20,40), DB(20,30), DC(40,30), Dalpha, Dbeta
11
 
      external CGEMM
12
 
      external ZGEMM
13
 
      external SGEMM
14
 
      external DGEMM
15
 
      M = 10
16
 
      N = 20
17
 
      K = 15
18
 
      LDA = 20
19
 
      LDB = 20
20
 
      LDC = 40
21
 
      Calpha = 2.0
22
 
      Cbeta = 2.0
23
 
      Zalpha = 2.0
24
 
      Zbeta = 2.0
25
 
      Salpha = 2.0
26
 
      Sbeta = 2.0
27
 
      Dalpha = 2.0
28
 
      Dbeta = 2.0
29
 
      CALL CGEMM ('T','N',M,N,K,Calpha,CA,LDA,CB,LDB,Cbeta,CC,LDC)
30
 
      CALL ZGEMM ('T','N',M,N,K,Zalpha,ZA,LDA,ZB,LDB,Zbeta,ZC,LDC)
31
 
      CALL SGEMM ('T','N',M,N,K,Salpha,SA,LDA,SB,LDB,Sbeta,SC,LDC)
32
 
      CALL DGEMM ('T','N',M,N,K,Dalpha,DA,LDA,DB,LDB,Dbeta,DC,LDC)]])])
33
 
])
34
 
 
35
 
# GA_C_BLAS_TEST
36
 
# --------------
37
 
# Generate C conftest for BLAS.
38
 
AC_DEFUN([GA_C_BLAS_TEST], [AC_LANG_CONFTEST([AC_LANG_PROGRAM(
39
 
[#ifdef __cplusplus
40
 
extern "C" {
41
 
#endif
42
 
char cgemm ();
43
 
char dgemm ();
44
 
char sgemm ();
45
 
char zgemm ();
46
 
#ifdef __cplusplus
47
 
}
48
 
#endif
49
 
],
50
 
[[char cresult =  cgemm ();
51
 
char dresult =  dgemm ();
52
 
char sresult =  sgemm ();
53
 
char zresult =  zgemm ();
54
 
]])])
55
 
])
56
 
 
57
 
# GA_C_RUN_BLAS_TEST
58
 
# ------------------
59
 
# Test the C linker.
60
 
# Clears BLAS_LIBS on failure.  Sets ga_blas_ok=yes on success.
61
 
AC_DEFUN([GA_C_RUN_BLAS_TEST], [
62
 
   AC_LANG_PUSH([C])
63
 
   GA_C_BLAS_TEST()
64
 
   AC_LINK_IFELSE([], [ga_blas_ok=yes], [BLAS_LIBS=])
65
 
   AC_LANG_POP([C])
66
 
])dnl
67
 
 
68
 
# GA_F77_RUN_BLAS_TEST
69
 
# --------------------
70
 
# Test the Fortran 77 linker.
71
 
# Clears BLAS_LIBS on failure.  Sets ga_blas_ok=yes on success.
72
 
AC_DEFUN([GA_F77_RUN_BLAS_TEST], [
73
 
   AC_LANG_PUSH([Fortran 77])
74
 
   GA_F77_BLAS_TEST()
75
 
   AC_LINK_IFELSE([], [ga_blas_ok=yes], [BLAS_LIBS=])
76
 
   AC_LANG_POP([Fortran 77])
77
 
])dnl
78
 
 
79
 
# GA_RUN_BLAS_TEST
80
 
# ----------------
81
 
# Test the linker.
82
 
# Clears BLAS_LIBS on failure.  Sets ga_blas_ok=yes on success.
83
 
AC_DEFUN([GA_RUN_BLAS_TEST], [
84
 
AS_IF([test "x$enable_f77" = xno],
85
 
   [AC_LANG_PUSH([C])
86
 
    GA_C_BLAS_TEST()
87
 
    AC_LINK_IFELSE([], [ga_blas_ok=yes], [BLAS_LIBS=])
88
 
    AC_LANG_POP([C])],
89
 
   [AC_LANG_PUSH([Fortran 77])
90
 
    GA_F77_BLAS_TEST()
91
 
    AC_LINK_IFELSE([], [ga_blas_ok=yes], [BLAS_LIBS=])
92
 
    AC_LANG_POP([Fortran 77])])
93
 
])dnl
94
 
 
95
 
# GA_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
96
 
# -------------------------------------------------
97
 
# Parse the --with-blas argument and test for all *gemm routines. We use
98
 
# different tests depending on whether Fortran sources are enabled. There are
99
 
# many flavors of BLAS that we test for explicitly, although the list could
100
 
# probably be reduced based on currently available systems.
101
 
#
102
 
# Apparently certain compilers on BGP define sgemm and dgemm, so we must
103
 
# test for a different BLAS routine. cgemm seems okay.
104
 
AC_DEFUN([GA_BLAS],
105
 
[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
106
 
blas_size=4
107
 
blas_size_hack=no
108
 
AC_ARG_WITH([blas],
109
 
    [AS_HELP_STRING([--with-blas[[=ARG]]],
110
 
        [use external BLAS library; attempt to detect sizeof(INTEGER)])],
111
 
    [blas_size_hack=yes])
112
 
AC_ARG_WITH([blas4],
113
 
    [AS_HELP_STRING([--with-blas4[[=ARG]]],
114
 
        [use external BLAS library compiled with sizeof(INTEGER)==4])],
115
 
    [blas_size=4; with_blas="$with_blas4"])
116
 
AC_ARG_WITH([blas8],
117
 
    [AS_HELP_STRING([--with-blas8[[=ARG]]],
118
 
        [use external BLAS library compiled with sizeof(INTEGER)==8])],
119
 
    [blas_size=8; with_blas="$with_blas8"])
120
 
 
121
 
ga_blas_ok=no
122
 
AS_IF([test "x$with_blas" = xno], [ga_blas_ok=skip])
123
 
 
124
 
# Parse --with-blas argument. Clear previous values first.
125
 
BLAS_LIBS=
126
 
BLAS_LDFLAGS=
127
 
BLAS_CPPFLAGS=
128
 
GA_ARG_PARSE([with_blas], [BLAS_LIBS], [BLAS_LDFLAGS], [BLAS_CPPFLAGS])
129
 
 
130
 
# Get fortran linker names of BLAS functions to check for.
131
 
AC_F77_FUNC(cgemm)
132
 
AC_F77_FUNC(dgemm)
133
 
AC_F77_FUNC(sgemm)
134
 
AC_F77_FUNC(zgemm)
135
 
 
136
 
ga_save_LIBS="$LIBS"
137
 
ga_save_LDFLAGS="$LDFLAGS";     LDFLAGS="$BLAS_LDFLAGS $LDFLAGS"
138
 
ga_save_CPPFLAGS="$CPPFLAGS";   CPPFLAGS="$BLAS_CPPFLAGS $CPPFLAGS"
139
 
 
140
 
AC_MSG_NOTICE([Attempting to locate BLAS library])
141
 
 
142
 
# First, check environment/command-line variables.
143
 
# If failed, erase BLAS_LIBS but maintain BLAS_LDFLAGS and BLAS_CPPFLAGS.
144
 
AS_IF([test $ga_blas_ok = no],
145
 
    [AC_MSG_CHECKING([for BLAS with user-supplied flags])
146
 
     LIBS="$BLAS_LIBS $LIBS"
147
 
     GA_RUN_BLAS_TEST()
148
 
     LIBS="$ga_save_LIBS"
149
 
     AS_IF([test $ga_blas_ok = yes],
150
 
        [AS_IF([test $blas_size_hack = yes],
151
 
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
152
 
                [*ilp64*],  [blas_size=8],     # Intel MKL
153
 
                [*_int64*], [blas_size=8])])]) # AMD ACML
154
 
     AC_MSG_RESULT([$ga_blas_ok])])
155
 
 
156
 
# AMD Core Math Library (ACML)
157
 
AS_IF([test $ga_blas_ok = no],
158
 
    [AC_MSG_CHECKING([for BLAS in AMD Core Math Library])
159
 
     # add -lacml to BLAS_LIBS if missing from LIBS
160
 
     AS_CASE([$LIBS], [*acml*], [], [BLAS_LIBS="-lacml"])
161
 
     LIBS="$BLAS_LIBS $LIBS"
162
 
     GA_RUN_BLAS_TEST()
163
 
     LIBS="$ga_save_LIBS"
164
 
     AS_IF([test "x$ga_blas_ok" = xyes],
165
 
        [AS_IF([test $blas_size_hack = yes],
166
 
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
167
 
                [*_int64*], [blas_size=8])])])
168
 
     AC_MSG_RESULT([$ga_blas_ok])])
169
 
 
170
 
# Intel MKL library
171
 
AS_IF([test $ga_blas_ok = no],
172
 
    [AC_MSG_CHECKING([for BLAS in Intel Math Kernel Library])
173
 
     # add -lmkl to BLAS_LIBS if missing from LIBS
174
 
     AS_CASE([$LIBS], [*mkl*], [], [BLAS_LIBS="-lmkl"])
175
 
     LIBS="$BLAS_LIBS $LIBS"
176
 
     GA_RUN_BLAS_TEST()
177
 
     LIBS="$ga_save_LIBS"
178
 
     AS_IF([test "x$ga_blas_ok" = xyes],
179
 
        [AS_IF([test $blas_size_hack = yes],
180
 
            [AS_CASE(["$BLAS_LIBS $LIBS $LDFLAGS $CPPFLAGS"],
181
 
                [*ilp64*], [blas_size=8])])])
182
 
     AC_MSG_RESULT([$ga_blas_ok])])
183
 
 
184
 
# ATLAS library (http://math-atlas.sourceforge.net/)
185
 
AS_IF([test $ga_blas_ok = no],
186
 
    [AC_MSG_CHECKING([for BLAS in ATLAS])
187
 
     AS_IF([test "x$enable_f77" = xno],
188
 
        [# add -lcblas if needed but missing from LIBS
189
 
         AS_CASE([$LIBS], [*cblas*], [], [BLAS_LIBS="-lcblas"])],
190
 
        [# add -lf77blas if needed but missing from LIBS
191
 
         AS_CASE([$LIBS], [*f77blas*], [], [BLAS_LIBS="-lf77blas"])])
192
 
     # add -latlas if needed but missing from LIBS
193
 
     AS_CASE([$LIBS], [*atlas*], [], [BLAS_LIBS="$BLAS_LIBS -latlas"])
194
 
     LIBS="$BLAS_LIBS $LIBS"
195
 
     GA_RUN_BLAS_TEST()
196
 
     LIBS="$ga_save_LIBS"
197
 
     AC_MSG_RESULT([$ga_blas_ok])])
198
 
 
199
 
# PhiPACK libraries (requires generic BLAS lib, too)
200
 
AS_IF([test $ga_blas_ok = no],
201
 
    [AC_MSG_CHECKING([for BLAS in PhiPACK libraries])
202
 
     # add -lblas to BLAS_LIBS if missing from LIBS
203
 
     AS_CASE([$LIBS], [*blas*], [], [BLAS_LIBS="-lblas"])
204
 
     # add -ldgemm to BLAS_LIBS if missing from LIBS
205
 
     AS_CASE([$LIBS], [*dgemm*], [], [BLAS_LIBS="-ldgemm $BLAS_LIBS"])
206
 
     # add -lsgemm to BLAS_LIBS if missing from LIBS
207
 
     AS_CASE([$LIBS], [*sgemm*], [], [BLAS_LIBS="-lsgemm $BLAS_LIBS"])
208
 
     LIBS="$BLAS_LIBS $LIBS"
209
 
     GA_RUN_BLAS_TEST()
210
 
     LIBS="$ga_save_LIBS"
211
 
     AC_MSG_RESULT([$ga_blas_ok])])
212
 
 
213
 
# Apple Accelerate.framework
214
 
AS_IF([test $ga_blas_ok = no],
215
 
    [AC_MSG_CHECKING([for BLAS in Apple Accelerate.framework])
216
 
     # add -framework Accelerate to BLAS_LIBS if missing from LIBS
217
 
     AS_CASE([$LIBS], [*Accelerate*], [], [BLAS_LIBS="-framework Accelerate"])
218
 
     LIBS="$BLAS_LIBS $LIBS"
219
 
     GA_RUN_BLAS_TEST()
220
 
     LIBS="$ga_save_LIBS"
221
 
     AC_MSG_RESULT([$ga_blas_ok])])
222
 
 
223
 
# Apple vecLib.framework
224
 
AS_IF([test $ga_blas_ok = no],
225
 
    [AC_MSG_CHECKING([for BLAS in Apple vecLib.framework])
226
 
     # add -framework vecLib to BLAS_LIBS if missing from LIBS
227
 
     AS_CASE([$LIBS], [*vecLib*], [], [BLAS_LIBS="-framework vecLib"])
228
 
     LIBS="$BLAS_LIBS $LIBS"
229
 
     GA_RUN_BLAS_TEST()
230
 
     LIBS="$ga_save_LIBS"
231
 
     AC_MSG_RESULT([$ga_blas_ok])])
232
 
 
233
 
# Alpha CXML library (CXML stands for Compaq Extended Math Library)
234
 
AS_IF([test $ga_blas_ok = no],
235
 
    [AC_MSG_CHECKING([for BLAS in Alpha CXML library])
236
 
     # add -lcxml to BLAS_LIBS if missing from LIBS
237
 
     AS_CASE([$LIBS], [*cxml*], [], [BLAS_LIBS="-lcxml"])
238
 
     LIBS="$BLAS_LIBS $LIBS"
239
 
     GA_RUN_BLAS_TEST()
240
 
     LIBS="$ga_save_LIBS"
241
 
     AS_IF([test $ga_blas_ok = no],
242
 
        [# add -lcxml to BLAS_LIBS if missing from LIBS
243
 
         AS_CASE([$LIBS], [*cxml*], [], [BLAS_LIBS="-lcxml"])
244
 
         # add -lcpml to BLAS_LIBS if missing from LIBS
245
 
         AS_CASE([$LIBS], [*cpml*], [], [BLAS_LIBS="$BLAS_LIBS -lcpml"])
246
 
         LIBS="$BLAS_LIBS $LIBS"
247
 
         GA_RUN_BLAS_TEST()
248
 
         LIBS="$ga_save_LIBS"])
249
 
     AC_MSG_RESULT([$ga_blas_ok])])
250
 
 
251
 
# Alpha DXML library (now called CXML, see above)
252
 
 
253
 
# Sun Performance library
254
 
AS_IF([test $ga_blas_ok = no],
255
 
    [AC_MSG_CHECKING([for BLAS in Sun Performance Library])
256
 
     # add -xlic_lib=sunperf to BLAS_LIBS if missing from LIBS
257
 
     AS_CASE([$LIBS], [*sunperf*], [], [BLAS_LIBS="-xlic_lib=sunperf"])
258
 
     LIBS="$BLAS_LIBS $LIBS"
259
 
     GA_RUN_BLAS_TEST()
260
 
     LIBS="$ga_save_LIBS"
261
 
     AS_IF([test $ga_blas_ok = no],
262
 
        [# add -xlic_lib=sunperf to BLAS_LIBS if missing from LIBS
263
 
         AS_CASE([$LIBS], [*sunperf*], [], [BLAS_LIBS="-xlic_lib=sunperf"])
264
 
         # add -lsunmath to BLAS_LIBS if missing from LIBS
265
 
         AS_CASE([$LIBS], [*sunmath*], [], [BLAS_LIBS="$BLAS_LIBS -lsunmath"])
266
 
         LIBS="$BLAS_LIBS $LIBS"
267
 
         GA_RUN_BLAS_TEST()
268
 
         LIBS="$ga_save_LIBS"])
269
 
     AC_MSG_RESULT([$ga_blas_ok])])
270
 
 
271
 
# SCSL library (SCSL stands for SGI/Cray Scientific Library)
272
 
AS_IF([test $ga_blas_ok = no],
273
 
    [AC_MSG_CHECKING([for BLAS in SGI/Cray Scientific Library])
274
 
     # add -lscs to BLAS_LIBS if missing from LIBS
275
 
     AS_CASE([$LIBS], [*scs*], [], [BLAS_LIBS="-lscs"])
276
 
     LIBS="$BLAS_LIBS $LIBS"
277
 
     GA_RUN_BLAS_TEST()
278
 
     LIBS="$ga_save_LIBS"
279
 
     AC_MSG_RESULT([$ga_blas_ok])])
280
 
 
281
 
# SGIMATH library
282
 
AS_IF([test $ga_blas_ok = no],
283
 
    [AC_MSG_CHECKING([for BLAS in SGIMATH library])
284
 
     # add -lcomplib.sgimath to BLAS_LIBS if missing from LIBS
285
 
     AS_CASE([$LIBS], [*complib.sgimath*], [], [BLAS_LIBS="-lcomplib.sgimath"])
286
 
     LIBS="$BLAS_LIBS $LIBS"
287
 
     GA_RUN_BLAS_TEST()
288
 
     LIBS="$ga_save_LIBS"
289
 
     AC_MSG_RESULT([$ga_blas_ok])])
290
 
 
291
 
# IBM ESSL library (requires generic BLAS lib, too)
292
 
AS_IF([test $ga_blas_ok = no],
293
 
    [AC_MSG_CHECKING([for BLAS in IBM ESSL library])
294
 
     # add -lessl to BLAS_LIBS if missing from LIBS
295
 
     AS_CASE([$LIBS], [*essl*], [], [BLAS_LIBS="-lessl"])
296
 
     # add -lblas to BLAS_LIBS if missing from LIBS
297
 
     AS_CASE([$LIBS], [*blas*], [], [BLAS_LIBS="$BLAS_LIBS -lblas"])
298
 
     LIBS="$BLAS_LIBS $LIBS"
299
 
     GA_RUN_BLAS_TEST()
300
 
     LIBS="$ga_save_LIBS"
301
 
     AC_MSG_RESULT([$ga_blas_ok])])
302
 
 
303
 
# Generic BLAS library
304
 
AS_IF([test $ga_blas_ok = no],
305
 
    [AC_MSG_CHECKING([for BLAS in generic library])
306
 
     BLAS_LIBS="-lblas"
307
 
     LIBS="$BLAS_LIBS $LIBS"
308
 
     GA_RUN_BLAS_TEST()
309
 
     LIBS="$ga_save_LIBS"
310
 
     AC_MSG_RESULT([$ga_blas_ok])])
311
 
 
312
 
CPPFLAGS="$ga_save_CPPFLAGS"
313
 
LDFLAGS="$ga_save_LDFLAGS"
314
 
 
315
 
AC_SUBST([BLAS_LIBS])
316
 
AC_SUBST([BLAS_LDFLAGS])
317
 
AC_SUBST([BLAS_CPPFLAGS])
318
 
 
319
 
# Tests are complete. Execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
320
 
AS_IF([test $ga_blas_ok = yes],
321
 
    [have_blas=1
322
 
     $1],
323
 
    [AC_MSG_WARN([BLAS library not found, using internal BLAS])
324
 
     blas_size=$ga_cv_f77_integer_size # reset blas integer size to desired
325
 
     have_blas=0
326
 
     $2])
327
 
AC_DEFINE_UNQUOTED([HAVE_BLAS], [$have_blas],
328
 
    [Define to 1 if using external BLAS library])
329
 
AC_DEFINE_UNQUOTED([BLAS_SIZE], [$blas_size],
330
 
    [Define to sizeof(INTEGER) used to compile BLAS])
331
 
AM_CONDITIONAL([HAVE_BLAS], [test $ga_blas_ok = yes])
332
 
])dnl GA_BLAS