Eigne Matrix Class Library
Dependents: Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more
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_BLAS) || defined(EIGEN_USE_LAPACKE) || 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_BLAS 00068 # undef EIGEN_USE_LAPACKE 00069 # undef EIGEN_USE_MKL_VML 00070 # undef EIGEN_USE_LAPACKE_STRICT 00071 # undef EIGEN_USE_LAPACKE 00072 # endif 00073 #endif 00074 00075 #if defined EIGEN_USE_MKL 00076 #include <mkl_lapacke.h> 00077 #define EIGEN_MKL_VML_THRESHOLD 128 00078 00079 /* MKL_DOMAIN_BLAS, etc are defined only in 10.3 update 7 */ 00080 /* MKL_BLAS, etc are not defined in 11.2 */ 00081 #ifdef MKL_DOMAIN_ALL 00082 #define EIGEN_MKL_DOMAIN_ALL MKL_DOMAIN_ALL 00083 #else 00084 #define EIGEN_MKL_DOMAIN_ALL MKL_ALL 00085 #endif 00086 00087 #ifdef MKL_DOMAIN_BLAS 00088 #define EIGEN_MKL_DOMAIN_BLAS MKL_DOMAIN_BLAS 00089 #else 00090 #define EIGEN_MKL_DOMAIN_BLAS MKL_BLAS 00091 #endif 00092 00093 #ifdef MKL_DOMAIN_FFT 00094 #define EIGEN_MKL_DOMAIN_FFT MKL_DOMAIN_FFT 00095 #else 00096 #define EIGEN_MKL_DOMAIN_FFT MKL_FFT 00097 #endif 00098 00099 #ifdef MKL_DOMAIN_VML 00100 #define EIGEN_MKL_DOMAIN_VML MKL_DOMAIN_VML 00101 #else 00102 #define EIGEN_MKL_DOMAIN_VML MKL_VML 00103 #endif 00104 00105 #ifdef MKL_DOMAIN_PARDISO 00106 #define EIGEN_MKL_DOMAIN_PARDISO MKL_DOMAIN_PARDISO 00107 #else 00108 #define EIGEN_MKL_DOMAIN_PARDISO MKL_PARDISO 00109 #endif 00110 00111 namespace Eigen { 00112 00113 typedef std::complex<double> dcomplex; 00114 typedef std::complex<float> scomplex; 00115 00116 namespace internal { 00117 00118 template<typename MKLType, typename EigenType> 00119 static inline void assign_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) { 00120 mklScalar=eigenScalar; 00121 } 00122 00123 template<typename MKLType, typename EigenType> 00124 static inline void assign_conj_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) { 00125 mklScalar=eigenScalar; 00126 } 00127 00128 template <> 00129 inline void assign_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) { 00130 mklScalar.real=eigenScalar.real(); 00131 mklScalar.imag=eigenScalar.imag(); 00132 } 00133 00134 template <> 00135 inline void assign_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) { 00136 mklScalar.real=eigenScalar.real(); 00137 mklScalar.imag=eigenScalar.imag(); 00138 } 00139 00140 template <> 00141 inline void assign_conj_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) { 00142 mklScalar.real=eigenScalar.real(); 00143 mklScalar.imag=-eigenScalar.imag(); 00144 } 00145 00146 template <> 00147 inline void assign_conj_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) { 00148 mklScalar.real=eigenScalar.real(); 00149 mklScalar.imag=-eigenScalar.imag(); 00150 } 00151 00152 } // end namespace internal 00153 00154 } // end namespace Eigen 00155 00156 #endif 00157 00158 #endif // EIGEN_MKL_SUPPORT_H
Generated on Tue Jul 12 2022 17:46:58 by 1.7.2