cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

MKL_support.h (4268B)


      1 /*
      2  Copyright (c) 2011, Intel Corporation. All rights reserved.
      3 
      4  Redistribution and use in source and binary forms, with or without modification,
      5  are permitted provided that the following conditions are met:
      6 
      7  * Redistributions of source code must retain the above copyright notice, this
      8    list of conditions and the following disclaimer.
      9  * Redistributions in binary form must reproduce the above copyright notice,
     10    this list of conditions and the following disclaimer in the documentation
     11    and/or other materials provided with the distribution.
     12  * Neither the name of Intel Corporation nor the names of its contributors may
     13    be used to endorse or promote products derived from this software without
     14    specific prior written permission.
     15 
     16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     17  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
     20  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     23  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     25  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 
     27  ********************************************************************************
     28  *   Content : Eigen bindings to Intel(R) MKL
     29  *   Include file with common MKL declarations
     30  ********************************************************************************
     31 */
     32 
     33 #ifndef EIGEN_MKL_SUPPORT_H
     34 #define EIGEN_MKL_SUPPORT_H
     35 
     36 #ifdef EIGEN_USE_MKL_ALL
     37   #ifndef EIGEN_USE_BLAS
     38     #define EIGEN_USE_BLAS
     39   #endif
     40   #ifndef EIGEN_USE_LAPACKE
     41     #define EIGEN_USE_LAPACKE
     42   #endif
     43   #ifndef EIGEN_USE_MKL_VML
     44     #define EIGEN_USE_MKL_VML
     45   #endif
     46 #endif
     47 
     48 #ifdef EIGEN_USE_LAPACKE_STRICT
     49   #define EIGEN_USE_LAPACKE
     50 #endif
     51 
     52 #if defined(EIGEN_USE_MKL_VML) && !defined(EIGEN_USE_MKL)
     53   #define EIGEN_USE_MKL
     54 #endif
     55 
     56 
     57 #if defined EIGEN_USE_MKL
     58 #   if (!defined MKL_DIRECT_CALL) && (!defined EIGEN_MKL_NO_DIRECT_CALL)
     59 #       define MKL_DIRECT_CALL
     60 #       define MKL_DIRECT_CALL_JUST_SET
     61 #   endif
     62 #   include <mkl.h>
     63 /*Check IMKL version for compatibility: < 10.3 is not usable with Eigen*/
     64 #   ifndef INTEL_MKL_VERSION
     65 #       undef EIGEN_USE_MKL /* INTEL_MKL_VERSION is not even defined on older versions */
     66 #   elif INTEL_MKL_VERSION < 100305    /* the intel-mkl-103-release-notes say this was when the lapacke.h interface was added*/
     67 #       undef EIGEN_USE_MKL
     68 #   endif
     69 #   ifndef EIGEN_USE_MKL
     70     /*If the MKL version is too old, undef everything*/
     71 #       undef   EIGEN_USE_MKL_ALL
     72 #       undef   EIGEN_USE_LAPACKE
     73 #       undef   EIGEN_USE_MKL_VML
     74 #       undef   EIGEN_USE_LAPACKE_STRICT
     75 #       undef   EIGEN_USE_LAPACKE
     76 #       ifdef   MKL_DIRECT_CALL_JUST_SET
     77 #           undef MKL_DIRECT_CALL
     78 #       endif
     79 #   endif
     80 #endif
     81 
     82 #if defined EIGEN_USE_MKL
     83 
     84 #define EIGEN_MKL_VML_THRESHOLD 128
     85 
     86 /* MKL_DOMAIN_BLAS, etc are defined only in 10.3 update 7 */
     87 /* MKL_BLAS, etc are not defined in 11.2 */
     88 #ifdef MKL_DOMAIN_ALL
     89 #define EIGEN_MKL_DOMAIN_ALL MKL_DOMAIN_ALL
     90 #else
     91 #define EIGEN_MKL_DOMAIN_ALL MKL_ALL
     92 #endif
     93 
     94 #ifdef MKL_DOMAIN_BLAS
     95 #define EIGEN_MKL_DOMAIN_BLAS MKL_DOMAIN_BLAS
     96 #else
     97 #define EIGEN_MKL_DOMAIN_BLAS MKL_BLAS
     98 #endif
     99 
    100 #ifdef MKL_DOMAIN_FFT
    101 #define EIGEN_MKL_DOMAIN_FFT MKL_DOMAIN_FFT
    102 #else
    103 #define EIGEN_MKL_DOMAIN_FFT MKL_FFT
    104 #endif
    105 
    106 #ifdef MKL_DOMAIN_VML
    107 #define EIGEN_MKL_DOMAIN_VML MKL_DOMAIN_VML
    108 #else
    109 #define EIGEN_MKL_DOMAIN_VML MKL_VML
    110 #endif
    111 
    112 #ifdef MKL_DOMAIN_PARDISO
    113 #define EIGEN_MKL_DOMAIN_PARDISO MKL_DOMAIN_PARDISO
    114 #else
    115 #define EIGEN_MKL_DOMAIN_PARDISO MKL_PARDISO
    116 #endif
    117 #endif
    118 
    119 #if defined(EIGEN_USE_BLAS) && !defined(EIGEN_USE_MKL)
    120 #include "../../misc/blas.h"
    121 #endif
    122 
    123 namespace Eigen {
    124 
    125 typedef std::complex<double> dcomplex;
    126 typedef std::complex<float>  scomplex;
    127 
    128 #if defined(EIGEN_USE_MKL)
    129 typedef MKL_INT BlasIndex;
    130 #else
    131 typedef int BlasIndex;
    132 #endif
    133 
    134 } // end namespace Eigen
    135 
    136 
    137 #endif // EIGEN_MKL_SUPPORT_H