2011-12-09 23:52:37 +08:00
/*
Copyright (c) 2011, Intel Corporation. All rights reserved.
Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************
* Content : Documentation on the use of Intel MKL through Eigen
********************************************************************************
*/
namespace Eigen {
2016-07-26 17:11:59 +08:00
/** \page TopicUsingIntelMKL Using Intel® MKL from %Eigen
2011-12-09 23:52:37 +08:00
2016-07-26 00:41:26 +08:00
<!-- \section TopicUsingIntelMKL_Intro Eigen and Intel® Math Kernel Library (Intel® MKL) -->
2016-07-26 17:11:59 +08:00
Since %Eigen version 3.1 and later, users can benefit from built-in Intel® Math Kernel Library (MKL) optimizations with an installed copy of Intel MKL 10.3 (or later).
2011-12-09 23:52:37 +08:00
<a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php"> Intel MKL </a> provides highly optimized multi-threaded mathematical routines for x86-compatible architectures.
Intel MKL is available on Linux, Mac and Windows for both Intel64 and IA32 architectures.
2015-09-07 17:23:55 +08:00
\note
Intel® MKL is a proprietary software and it is the responsibility of users to buy or register for community (free) Intel MKL licenses for their products. Moreover, the license of the user product has to allow linking to proprietary software that excludes any unmodified versions of the GPL.
2011-12-09 23:52:37 +08:00
2016-07-26 17:11:59 +08:00
Using Intel MKL through %Eigen is easy:
-# define the \c EIGEN_USE_MKL_ALL macro before including any %Eigen's header
2011-12-09 23:52:37 +08:00
-# link your program to MKL libraries (see the <a href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/">MKL linking advisor</a>)
2012-06-21 16:51:22 +08:00
-# on a 64bits system, you must use the LP64 interface (not the ILP64 one)
2011-12-09 23:52:37 +08:00
2016-07-26 17:11:59 +08:00
When doing so, a number of %Eigen's algorithms are silently substituted with calls to Intel MKL routines.
2011-12-09 23:52:37 +08:00
These substitutions apply only for \b Dynamic \b or \b large enough objects with one of the following four standard scalar types: \c float, \c double, \c complex<float>, and \c complex<double>.
Operations on other scalar types or mixing reals and complexes will continue to use the built-in algorithms.
2016-01-24 22:50:36 +08:00
In addition you can choose which parts will be substituted by defining one or multiple of the following macros:
2011-12-09 23:52:37 +08:00
<table class="manual">
2016-07-26 17:11:59 +08:00
<tr><td>\c EIGEN_USE_BLAS </td><td>Enables the use of external BLAS level 2 and 3 routines</td></tr>
<tr class="alt"><td>\c EIGEN_USE_LAPACKE </td><td>Enables the use of external Lapack routines via the <a href="http://www.netlib.org/lapack/lapacke.html">Lapacke</a> C interface to Lapack</td></tr>
2016-07-26 00:41:26 +08:00
<tr><td>\c EIGEN_USE_LAPACKE_STRICT </td><td>Same as \c EIGEN_USE_LAPACKE but algorithm of lower robustness are disabled. \n This currently concerns only JacobiSVD which otherwise would be replaced by \c gesvd that is less robust than Jacobi rotations.</td></tr>
2011-12-09 23:52:37 +08:00
<tr class="alt"><td>\c EIGEN_USE_MKL_VML </td><td>Enables the use of Intel VML (vector operations)</td></tr>
<tr><td>\c EIGEN_USE_MKL_ALL </td><td>Defines \c EIGEN_USE_BLAS, \c EIGEN_USE_LAPACKE, and \c EIGEN_USE_MKL_VML </td></tr>
</table>
2016-07-26 17:11:59 +08:00
Note that the BLAS and LAPACKE backends can be enabled for any F77 compatible BLAS and LAPACK libraries. See this \link TopicUsingBlasLapack page \endlink for the details.
2011-12-09 23:52:37 +08:00
2016-07-26 17:11:59 +08:00
Finally, the PARDISO sparse solver shipped with Intel MKL can be used through the \ref PardisoLU, \ref PardisoLLT and \ref PardisoLDLT classes of the \ref PardisoSupport_Module.
2011-12-09 23:52:37 +08:00
2016-07-26 17:11:59 +08:00
The following table summarizes the list of functions covered by \c EIGEN_USE_MKL_VML:
2011-12-09 23:52:37 +08:00
<table class="manual">
2016-07-26 17:11:59 +08:00
<tr><th>Code example</th><th>MKL routines</th></tr>
<tr><td>\code
2011-12-09 23:52:37 +08:00
v2=v1.array().sin();
v2=v1.array().asin();
v2=v1.array().cos();
v2=v1.array().acos();
v2=v1.array().tan();
v2=v1.array().exp();
v2=v1.array().log();
v2=v1.array().sqrt();
v2=v1.array().square();
v2=v1.array().pow(1.5);
\endcode</td><td>\code
v?Sin
v?Asin
v?Cos
v?Acos
v?Tan
v?Exp
v?Ln
v?Sqrt
v?Sqr
v?Powx
\endcode</td></tr>
</table>
2016-07-26 17:11:59 +08:00
In the examples, v1 and v2 are dense vectors.
2011-12-09 23:52:37 +08:00
\section TopicUsingIntelMKL_Links Links
- Intel MKL can be purchased and downloaded <a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php">here</a>.
- Intel MKL is also bundled with <a href="http://software.intel.com/en-us/articles/intel-composer-xe/">Intel Composer XE</a>.
*/
Big changes in Eigen documentation:
- Organize the documentation into "chapters".
- Each chapter include many documentation pages, reference pages organized as modules, and a quick reference page.
- The "Chapters" tree is created using the defgroup/ingroup mechanism, even for the documentation pages (i.e., .dox files for which I added an \eigenManualPage macro that we can switch between \page or \defgroup ).
- Add a "General topics" entry for all pages that do not fit well in the previous "chapters".
- The highlevel struture is managed by a new eigendoxy_layout.xml file.
- remove the "index" and quite useless pages (namespace list, class hierarchy, member list, file list, etc.)
- add the javascript search-engine.
- add the "treeview" panel.
- remove \tableofcontents (replace them by a custom \eigenAutoToc macro to be able to easily re-enable if needed).
- add javascript to automatically generate a TOC from the h1/h2 tags of the current page, and put the TOC in the left side panel.
- overload various javascript function generated by doxygen to:
- remove the root of the treeview
- remove links to section/subsection from the treeview
- automatically expand the "Chapters" section
- automatically expand the current section
- adjust the height of the treeview to take into account the TOC
- always use the default .css file, eigendoxy.css now only includes our modifications
- use Doxyfile to specify our logo
- remove cross references to unsupported modules (temporarily)
2013-01-05 23:37:11 +08:00
}