<div dir="ltr"><div>Brad,<br>I don&#39;t know why they don&#39;t automatically enable it. I understand what you mean but I would at least default to system FFTW if it is available in the system. One can expect this one to be optimized. The other thing is that <font><font><font><font><font><font><font><font><span>FFTW</span>_OPTIMIZATION_CONFIGURATION could be made more visible with an option.<br>

</font></font></font></font></font></font></font></font></div><font><font><font><font><font><font><font><font>Simon<br></font></font></font></font></font></font></font></font></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Sun, Apr 14, 2013 at 4:20 PM, Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">Simon,<div><br></div><div>Thanks for trying out the patch. Sorry for the parse error blunder.</div><div><br></div><div>Regarding the sse2 not being enable by default. I would view that as an issue with FFTW. Why do they not enable it by default? Every x86_64 processor has sse2 instructions. In general, determining optimal compilation flags for different platforms, and architectures in not done by defaults in ITK. I think it is just too big of a rabbit hole to open up.</div>

<div><br></div><div>Brad </div><div><div class="h5"><div><br><div><div>On Apr 14, 2013, at 8:15 AM, Simon Rit &lt;<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>&gt; wrote:</div>

<br><blockquote type="cite"><div dir="ltr"><div><div><div>Hi,<br>Thanks! A few things. First, going from the latest release to HEAD, I had a compilation issue:<br><font size="1">/home/<span>srit</span>/<span>src</span>/itk4/<span>itk</span>/Modules/Filtering/<span>FFT</span>/include/<span>itkFFTWHalfHermitianToRealInve</span><span>rseFFTImageFilter</span>.<span>hxx</span>:103:5:   required from ‘void <span>itk</span>::<span>FFTWHalfHermitianToRealInverse</span><span>FFTImageFilter</span>&lt;<span>TInputImage</span>, <span>TOutputImage</span>&gt;::<span>BeforeThreadedGenerateData</span>() [with <span>TInputImage</span> = <span>itk</span>::Image&lt;std::complex&lt;double&gt;, 3u&gt;; <span>TOutputImage</span> = <span>itk</span>::Image&lt;double, 3u&gt;]’<br>





/home/<span>srit</span>/<span>src</span>/<span>rtk</span>/<span>rtk</span>/testing/<span>rtkdisplaceddetectortest</span>.<span>cxx</span>:203:1:   required from here<br>

/<span>usr</span>/lib/<span>gcc</span>/x86_64-<span>redhat</span>-<span>linux</span>/4.7.2/../../../../include/c++/4.7.2/bits/<span>stl</span>_<span>algobase</span>.h:329:8: <span>erreur</span>: incompatible types in assignment of ‘const std::complex&lt;double&gt;’ to ‘double [2]’<br>





</font><br>I fixed it with a pointer cast<span></span><span></span><br><font size="1">diff --git a/Modules/Filtering/<span>FFT</span>/include/<span>itkFFTWHalfHermitianToRealInve</span><span>rseFFTImageFilter</span>.<span>hxx</span> b/Modules/Filtering/<span>FFT</span>/include/<span>itkFFTWHalfHermitianToRealInve</span><span>rseFFTImageFilter</span>.<span>hxx</span><br>





index 9338cb1..806d803 100644<br>--- a/Modules/Filtering/<span>FFT</span>/include/<span>itkFFTWHalfHermitianToRealInve</span><span>rseFFTImageFilter</span>.<span>hxx</span><br>

+++ b/Modules/Filtering/<span>FFT</span>/include/<span>itkFFTWHalfHermitianToRealInve</span><span>rseFFTImageFilter</span>.<span>hxx</span><br>@@ -100,7 +100,7 @@ <span>FFTWHalfHermitianToRealInverse</span><span>FFTImageFilter</span>&lt; <span>TInputImage</span>, <span>TOutputImage</span> &gt;<br>





                                       !m_<span>CanUseDestructiveAlgorithm</span> );<br>   if( !m_<span>CanUseDestructiveAlgorithm</span> )<br>     {<br>-    <span>itk</span>::algorithm::copy_n(<span>inputPtr</span>-&gt;<span>GetBufferPointer</span>(), <span>totalInputSize</span>,  in);<br>



+    <span>itk</span>::algorithm::copy_n((<span>typename</span> <span>FFTWProxyType</span>::<span>ComplexType</span>*)<span>inputPtr</span>-&gt;<span>GetBufferPointer</span>(), <span>totalInputSize</span>,  in);<br>



     }<br>   <span>FFTWProxyType</span>::Execute( plan );<br></font><br>Second, there is a missing parenthesis in the patch:<br><font size="1">/home/<span>srit</span>/<span>src</span>/itk4/lin64-<span>dg</span>/<span>fftwd</span>_configure_step.<span>cmake</span>:36:<br>



Parse error.  Function missing ending &quot;)&quot;.  End of file reached.<br>

<br></font></div><font>Finally, <font>the patch <font><span>propa</span><font>gates -O3 but d<font><span>oes</span></font> not fully fix the speed issue. A<font><span>fter</span> a bit more digging, it turns out that sse2 instructions are not automatically ac<font><span>tivated</span><font>. One must <font>set <span>FFTW</span>_OPTIMIZATION_CONFIGURATION to &quot;--enable-sse2&quot;. <span>Shoul</span><font><span>dn&#39;t</span> this be done automatically? <font>Setting it fixed the compilation time.</font><br>





</font></font></font></font></font></font></font></font></font></div><font><font><font><font><font><font><font><font><font><font>Thanks a<font>gain for your help<font>,<br></font></font></font></font></font></font></font></font></font></font></font></font></div>




<font>
<font><font><font><font><font><font><font><font><font><font><font><font><font>Simon</font><br></font></font><div class="gmail_extra"><font>
</font><br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 8:27 PM, Bradley <span>Lowekamp</span> <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank"><span>blowekamp</span>@mail.<span>nih</span>.gov</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello,<br>
<br>
I have placed a patch on gerrit for review:<br>
<br>
<a href="http://review.source.kitware.com/#/c/10848/" target="_blank">http://review.source.kitware.com/#/c/10848/</a><br>
<br>
Please let us know if works for you.<br>
<br>
Brad<br>
<div><br>
On Apr 12, 2013, at 12:15 PM, Bradley Lowekamp &lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt; wrote:<br>
<br>
&gt; Looking at the cmake build scripts:<br>
&gt;<br>
&gt; <a href="https://github.com/Kitware/ITK/blob/master/CMake/itkExternal_FFTW.cmake#L44" target="_blank">https://github.com/Kitware/ITK/blob/master/CMake/itkExternal_FFTW.cmake#L44</a><br>
&gt;<br>
&gt; It looks like CMAKE_C_FLAGS_RELEASE is not getting passed.<br>
&gt;<br>
&gt; I&#39;ll see if I can take this on after lunch.<br>
&gt;<br>
&gt; Brad<br>
&gt;<br>
&gt; On Apr 12, 2013, at 11:30 AM, Simon Rit &lt;<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; I&#39;m not sure it&#39;s the reason: I don&#39;t expect a two fold improvement<br>
&gt;&gt; and the system has the same version installed, 3.3.2. Are we sure that<br>
&gt;&gt; the release flags are passed to FFTW? When I looked at the compilation<br>
&gt;&gt; log, I don&#39;t see -O3, here is an excerpt:<br>
&gt;&gt;<br>
&gt;&gt; /bin/sh ../libtool --tag=CC   --mode=compile /usr/bin/cc -std=gnu99<br>
&gt;&gt; -DHAVE_CONFIG_H -I.<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd<br>
&gt;&gt; -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align<br>
&gt;&gt; -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch<br>
&gt;&gt; -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused<br>
&gt;&gt; -Wwrite-strings -funit-at-a-time -Wno-strict-overflow  -MT<br>
&gt;&gt; cpy2d-pair.lo -MD -MP -MF .deps/cpy2d-pair.Tpo -c -o cpy2d-pair.lo<br>
&gt;&gt; /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c<br>
&gt;&gt; libtool: compile:  /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized<br>
&gt;&gt; -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization<br>
&gt;&gt; -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral<br>
&gt;&gt; -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time<br>
&gt;&gt; -Wno-strict-overflow -MT cpy2d-pair.lo -MD -MP -MF<br>
&gt;&gt; .deps/cpy2d-pair.Tpo -c<br>
&gt;&gt; /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c -o<br>
&gt;&gt; cpy2d-pair.o<br>
&gt;&gt; mv -f .deps/cpy2d-pair.Tpo .deps/cpy2d-pair.Plo<br>
&gt;&gt; /bin/sh ../libtool --tag=CC   --mode=compile /usr/bin/cc -std=gnu99<br>
&gt;&gt; -DHAVE_CONFIG_H -I.<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd<br>
&gt;&gt; -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align<br>
&gt;&gt; -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch<br>
&gt;&gt; -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused<br>
&gt;&gt; -Wwrite-strings -funit-at-a-time -Wno-strict-overflow  -MT cpy2d.lo<br>
&gt;&gt; -MD -MP -MF .deps/cpy2d.Tpo -c -o cpy2d.lo<br>
&gt;&gt; /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c<br>
&gt;&gt; libtool: compile:  /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
&gt;&gt; -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized<br>
&gt;&gt; -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization<br>
&gt;&gt; -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral<br>
&gt;&gt; -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time<br>
&gt;&gt; -Wno-strict-overflow -MT cpy2d.lo -MD -MP -MF .deps/cpy2d.Tpo -c<br>
&gt;&gt; /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c -o cpy2d.o<br>
&gt;&gt; mv -f .deps/cpy2d.Tpo .deps/cpy2d.Plo<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Apr 12, 2013 at 5:21 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt; Looks like the fftw folks have made some efficiency improvements.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Fri, Apr 12, 2013 at 11:18 AM, Simon Rit &lt;<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I should have mentioned it: yes, it is!<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Fri, Apr 12, 2013 at 5:16 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt; Is your ITK built Release?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On Fri, Apr 12, 2013 at 11:13 AM, Simon Rit<br>
&gt;&gt;&gt;&gt;&gt; &lt;<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;&gt;&gt; We have recently observed on a fedora distribution that FFTW is two<br>
&gt;&gt;&gt;&gt;&gt;&gt; times slower when one uses the ITK compilation<br>
&gt;&gt;&gt;&gt;&gt;&gt; (USE_SYSTEM_FFTW:BOOL=OFF, default) than when one uses the system fftw<br>
&gt;&gt;&gt;&gt;&gt;&gt; (USE_SYSTEM_FFTW:BOOL=ON).<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; We have looked for an explanation in the flags (the Fedora flags are<br>
&gt;&gt;&gt;&gt;&gt;&gt; available here<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://pkgs.fedoraproject.org/cgit/fftw.git/tree/fftw.spec" target="_blank">http://pkgs.fedoraproject.org/cgit/fftw.git/tree/fftw.spec</a>)<br>
&gt;&gt;&gt;&gt;&gt;&gt; but we have not managed to figure it out. Would someone happen to have<br>
&gt;&gt;&gt;&gt;&gt;&gt; an explanation and solution?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Thanks in advance,<br>
&gt;&gt;&gt;&gt;&gt;&gt; Simon<br>
&gt;&gt;&gt;&gt;&gt;&gt; _____________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt; Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>
&gt;&gt; _____________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt;&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></blockquote></div><br></div></font></font></font></font></font></font></font></font></font></font></font></div>
</blockquote></div><br></div></div></div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>