Changeset 3453 for trunk/m4/yat_cblas.m4


Ignore:
Timestamp:
Dec 8, 2015, 4:53:16 AM (6 years ago)
Author:
Peter
Message:

closes #839

Simplify code by looping over different cblas implementations using
AC_SEARCH_LIBS rather than repeating code. Include search for satlas
and tatlas, which are the names in new versions of ATLAS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/m4/yat_cblas.m4

    r3452 r3453  
    6565                      [CBLAS_LIB=""])])
    6666
    67 # CBLAS linked to by default (or with current LIBS)
    68 if test $yat_cblas_ok = no; then
    69   AC_MSG_CHECKING([for cblas_sgemm])
    70   AC_LINK_IFELSE([AC_LANG_CALL(,[cblas_sgemm])],
    71                  [yat_cblas_ok=yes CBLAS_LIB=""])
    72   AC_MSG_RESULT([$yat_cblas_ok])
    73 fi
     67# Find library that implements cblas; search in the following order
     68# - CBLAS linked by default (or with current $LIBS)
     69# - CBLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
     70#   - tatlas
     71#   - satlas
     72# - CBLAS as -lcblas
     73# - Openblas available from http://xianyi.github.com/OpenBLAS/
     74# - CBLAS in Intel MKL library?
     75# - CBLAS in SCSL library (SGI/Cray Scientific Library)
     76AS_IF([test $yat_cblas_ok = no], [
     77  AC_SEARCH_LIBS([cblas_sgemm],
     78                 [tatlas satlas cblas opencblas mkl_core scs],
     79                 [yat_cblas_ok=yes;
     80                  AS_IF([test "$ac_cv_search_cblas_sgemm" != "none required"],[
     81                    CBLAS_LIB=$ac_cv_search_cblas_sgemm
     82                  ])
     83                 ])
     84  LIBS=$save_LIBS
     85])
    7486
    7587# CBLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
    76 if test $yat_cblas_ok = no; then
    77   AC_SEARCH_LIBS([ATL_xerbla], [atlas],
    78                  [AC_SEARCH_LIBS([cblas_sgemm], [cblas],
    79                                  [yat_cblas_ok=yes;
    80                                   CBLAS_LIB="-lcblas -latlas"])])
     88# Old atlas is linked in with -latlas -lcblas
     89AS_IF([test $yat_cblas_ok = no], [
     90  AC_CHECK_LIB([ATL_xerbla], [atlas],
     91               [AC_CHECK_LIB([cblas_sgemm], [cblas],
     92                             [yat_cblas_ok=yes;
     93                              CBLAS_LIB="-lcblas -latlas"])
     94               ])
    8195  LIBS=$save_LIBS;
    82 fi
    83 
    84 if test $yat_cblas_ok = no; then
    85   AC_CHECK_LIB([cblas], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lcblas";])
    86 fi
    87 
    88 # Openblas available from http://xianyi.github.com/OpenBLAS/
    89 if test $yat_cblas_ok = no; then
    90   AC_CHECK_LIB([opencblas], [cblas_sgemm],
    91                [yat_cblas_ok=yes; CBLAS_LIB="-lopencblas";])
    92 fi
    93 
    94 # CBLAS in Intel MKL library?
    95 if test $yat_cblas_ok = no; then
    96   AC_CHECK_LIB([mkl_core], [cblas_sgemm],
    97                [yat_blas_ok=yes; CBLAS_LIBS="-lmkl_core"])
    98 fi
    99 
    100 # CBLAS in SCSL library?  (SGI/Cray Scientific Library)
    101 if test $yat_cblas_ok = no; then
    102   AC_CHECK_LIB([scs], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lscs"])
    103 fi
     96])
    10497
    10598# Execute ACTION-IF-FOUND or ACTION-IF-NOT-FOUND
    106 AS_IF([test x"$yat_cblas_ok" = xyes],
     99AS_IF([test x"$yat_cblas_ok" = x"yes"],
    107100      [m4_default([$1], [:])],
    108101      [yat_cblas_ok=no; m4_default([$2], [:])])
Note: See TracChangeset for help on using the changeset viewer.