Eigen  3.3.3
MKL_support.h
00001 /*
00002  Copyright (c) 2011, Intel Corporation. All rights reserved.
00003 
00004  Redistribution and use in source and binary forms, with or without modification,
00005  are permitted provided that the following conditions are met:
00006 
00007  * Redistributions of source code must retain the above copyright notice, this
00008    list of conditions and the following disclaimer.
00009  * Redistributions in binary form must reproduce the above copyright notice,
00010    this list of conditions and the following disclaimer in the documentation
00011    and/or other materials provided with the distribution.
00012  * Neither the name of Intel Corporation nor the names of its contributors may
00013    be used to endorse or promote products derived from this software without
00014    specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00020  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00023  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027  ********************************************************************************
00028  *   Content : Eigen bindings to Intel(R) MKL
00029  *   Include file with common MKL declarations
00030  ********************************************************************************
00031 */
00032 
00033 #ifndef EIGEN_MKL_SUPPORT_H
00034 #define EIGEN_MKL_SUPPORT_H
00035 
00036 #ifdef EIGEN_USE_MKL_ALL
00037   #ifndef EIGEN_USE_BLAS
00038     #define EIGEN_USE_BLAS
00039   #endif
00040   #ifndef EIGEN_USE_LAPACKE
00041     #define EIGEN_USE_LAPACKE
00042   #endif
00043   #ifndef EIGEN_USE_MKL_VML
00044     #define EIGEN_USE_MKL_VML
00045   #endif
00046 #endif
00047 
00048 #ifdef EIGEN_USE_LAPACKE_STRICT
00049   #define EIGEN_USE_LAPACKE
00050 #endif
00051 
00052 #if defined(EIGEN_USE_MKL_VML)
00053   #define EIGEN_USE_MKL
00054 #endif
00055 
00056 #if defined EIGEN_USE_MKL
00057 #   include <mkl.h> 
00058 /*Check IMKL version for compatibility: < 10.3 is not usable with Eigen*/
00059 #   ifndef INTEL_MKL_VERSION
00060 #       undef EIGEN_USE_MKL /* INTEL_MKL_VERSION is not even defined on older versions */
00061 #   elif INTEL_MKL_VERSION < 100305    /* the intel-mkl-103-release-notes say this was when the lapacke.h interface was added*/
00062 #       undef EIGEN_USE_MKL
00063 #   endif
00064 #   ifndef EIGEN_USE_MKL
00065     /*If the MKL version is too old, undef everything*/
00066 #       undef   EIGEN_USE_MKL_ALL
00067 #       undef   EIGEN_USE_LAPACKE
00068 #       undef   EIGEN_USE_MKL_VML
00069 #       undef   EIGEN_USE_LAPACKE_STRICT
00070 #       undef   EIGEN_USE_LAPACKE
00071 #   endif
00072 #endif
00073 
00074 #if defined EIGEN_USE_MKL
00075 
00076 #define EIGEN_MKL_VML_THRESHOLD 128
00077 
00078 /* MKL_DOMAIN_BLAS, etc are defined only in 10.3 update 7 */
00079 /* MKL_BLAS, etc are not defined in 11.2 */
00080 #ifdef MKL_DOMAIN_ALL
00081 #define EIGEN_MKL_DOMAIN_ALL MKL_DOMAIN_ALL
00082 #else
00083 #define EIGEN_MKL_DOMAIN_ALL MKL_ALL
00084 #endif
00085 
00086 #ifdef MKL_DOMAIN_BLAS
00087 #define EIGEN_MKL_DOMAIN_BLAS MKL_DOMAIN_BLAS
00088 #else
00089 #define EIGEN_MKL_DOMAIN_BLAS MKL_BLAS
00090 #endif
00091 
00092 #ifdef MKL_DOMAIN_FFT
00093 #define EIGEN_MKL_DOMAIN_FFT MKL_DOMAIN_FFT
00094 #else
00095 #define EIGEN_MKL_DOMAIN_FFT MKL_FFT
00096 #endif
00097 
00098 #ifdef MKL_DOMAIN_VML
00099 #define EIGEN_MKL_DOMAIN_VML MKL_DOMAIN_VML
00100 #else
00101 #define EIGEN_MKL_DOMAIN_VML MKL_VML
00102 #endif
00103 
00104 #ifdef MKL_DOMAIN_PARDISO
00105 #define EIGEN_MKL_DOMAIN_PARDISO MKL_DOMAIN_PARDISO
00106 #else
00107 #define EIGEN_MKL_DOMAIN_PARDISO MKL_PARDISO
00108 #endif
00109 #endif
00110 
00111 namespace Eigen {
00112 
00113 typedef std::complex<double> dcomplex;
00114 typedef std::complex<float>  scomplex;
00115 
00116 #if defined(EIGEN_USE_MKL)
00117 typedef MKL_INT BlasIndex;
00118 #else
00119 typedef int BlasIndex;
00120 #endif
00121 
00122 } // end namespace Eigen
00123 
00124 #if defined(EIGEN_USE_BLAS)
00125 #include "../../misc/blas.h"
00126 #endif
00127 
00128 #endif // EIGEN_MKL_SUPPORT_H
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends