/usr/share/doc/libeigen3-dev/html/TopicMultiThreading.html is in libeigen3-doc 3.3.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>Eigen: Eigen and multi-threading</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!-- -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
<!-- <script type="text/javascript"> -->
<!-- </script> -->
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- <a name="top"></a> -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
 <span id="projectnumber">3.3.4</span>
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('TopicMultiThreading.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title"><a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> and multi-threading </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="TopicMultiThreading_MakingEigenMT"></a>
Make Eigen run in parallel</h1>
<p>Some <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>'s algorithms can exploit the multiple cores present in your hardware. To this end, it is enough to enable OpenMP on your compiler, for instance: GCC: <code>-fopenmp</code> ICC: <code>-openmp</code> MSVC: check the respective option in the build properties. You can control the number of thread that will be used using either the OpenMP API or <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>'s API using the following priority: </p><div class="fragment"><div class="line">OMP_NUM_THREADS=n ./my_program</div><div class="line">omp_set_num_threads(n);</div><div class="line">Eigen::setNbThreads(n);</div></div><!-- fragment --><p> Unless setNbThreads has been called, <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> uses the number of threads specified by OpenMP. You can restore this behavior by calling</p><div class="fragment"><div class="line">setNbThreads(0); </div></div><!-- fragment --><p> You can query the number of threads that will be used with: </p><div class="fragment"><div class="line">n = Eigen::nbThreads( );</div></div><!-- fragment --><p> You can disable <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>'s multi threading at compile time by defining the EIGEN_DONT_PARALLELIZE preprocessor token.</p>
<p>Currently, the following algorithms can make use of multi-threading:</p><ul>
<li>general dense matrix - matrix products</li>
<li><a class="el" href="classEigen_1_1PartialPivLU.html" title="LU decomposition of a matrix with partial pivoting, and related features. ">PartialPivLU</a></li>
<li>row-major-sparse * dense vector/matrix products</li>
<li><a class="el" href="classEigen_1_1ConjugateGradient.html" title="A conjugate gradient solver for sparse (or dense) self-adjoint problems. ">ConjugateGradient</a> with <code>Lower|Upper</code> as the <code>UpLo</code> template parameter.</li>
<li><a class="el" href="classEigen_1_1BiCGSTAB.html" title="A bi conjugate gradient stabilized solver for sparse square problems. ">BiCGSTAB</a> with a row-major sparse matrix format.</li>
<li><a class="el" href="classEigen_1_1LeastSquaresConjugateGradient.html" title="A conjugate gradient solver for sparse (or dense) least-square problems. ">LeastSquaresConjugateGradient</a></li>
</ul>
<h1><a class="anchor" id="TopicMultiThreading_UsingEigenWithMT"></a>
Using Eigen in a multi-threaded application</h1>
<p>In the case your own application is multithreaded, and multiple threads make calls to <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>, then you have to initialize <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> by calling the following routine <b>before</b> creating the threads: </p><div class="fragment"><div class="line"><span class="preprocessor">#include <Eigen/Core></span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv)</div><div class="line">{</div><div class="line"> Eigen::initParallel();</div><div class="line"> </div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>With <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> 3.3, and a fully C++11 compliant compiler (i.e., <a href="http://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables">thread-safe static local variable initialization</a>), then calling <code>initParallel()</code> is optional.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>note that all functions generating random matrices are <b>not</b> re-entrant nor thread-safe. Those include <a class="el" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">DenseBase::Random()</a>, and <a class="el" href="classEigen_1_1DenseBase.html#ac476e5852129ba32beaa1a8a3d7ee0db">DenseBase::setRandom()</a> despite a call to Eigen::initParallel(). This is because these functions are based on std::rand which is not re-entrant. For thread-safe random generator, we recommend the use of boost::random or c++11 random feature.</dd></dl>
<p>In the case your application is parallelized with OpenMP, you might want to disable <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>'s own parallization as detailed in the previous section. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>
|