Boost C++ Libraries: Ticket #13180: Loop vectorisation using boost multi_array https://svn.boost.org/trac10/ticket/13180 <p> Dear all </p> <p> I am trying to optimize a huge code that uses boost multi-arrays. And when I compile the code with the <em>-qopt-report=2 -qopt-report-phase=vec</em> options, I notice in the compilation report that most loops are not vectorized. </p> <p> I thus made a simple program to understand why, and I noticed that a loop that uses C array is vectorized, while the same loop using boost multi array is not (see test_vector.cpp) (see attached .cpp file). I get the following message: </p> <pre class="wiki">LOOP BEGIN at test_vector.cpp(29,5) remark #15520: loop was not vectorized: loop with multiple exits cannot be vectorized unless it meets search loop idiom criteria LOOP END </pre><p> A way to overcome this would be to use the data pointer in combination with the <code>#pragma ivdep</code> statement, but this becomes complicated when working on multimensional arrays. </p> <p> I thus would like to know if I am doing something wrong (for instance in the boost array initialisation), and if there is a way to fix this? </p> <p> I am using the icpc compiler, version 16.0.4, with boost library version 1.65. The program is compiled as follows: </p> <pre class="wiki">icpc -Ilibs/cpp/boost_1_65_0/ -O3 -qopt-report=2 -qopt-report-phase=vec test_vector.cpp </pre><p> Thanks a lot </p> <p> Nicolas Barrier </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13180 Trac 1.4.3 Nicolas Barrier <nicolas.barrier@…> Mon, 28 Aug 2017 07:09:30 GMT attachment set https://svn.boost.org/trac10/ticket/13180 https://svn.boost.org/trac10/ticket/13180 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_vector.cpp</span> </li> </ul> <p> Test code </p> Ticket