<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap:break-word; color:rgb(0,0,0); font-size:14px; font-family:Calibri,sans-serif">
<div>Simon,</div>
<div><br>
</div>
<div>This was posted last night into gerrit <a href="http://review.source.kitware.com/#/c/10850/3">http://review.source.kitware.com/#/c/10850/3</a>. The patch currently on gerrit uses an approach very similar to yours (Based on Brad Lowekamp's suggestion I
cast the "C" pointer, and leave "C++" pointer alone, and you do the opposite).</div>
<div><br>
</div>
<div>If I do not receive a negative feedback, this morning, I will merge it yet today.</div>
<div><br>
</div>
<div>Hans</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">From: </span>Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr">simon.rit@creatis.insa-lyon.fr</a>><br>
<span style="font-weight:bold">Date: </span>Sunday, April 14, 2013 7:15 AM<br>
<span style="font-weight:bold">To: </span>Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
<span style="font-weight:bold">Cc: </span>insight-users <<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Insight-users] ITK FFTW vs system FFTW<br>
</div>
<div><br>
</div>
<div>
<div>
<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 class="" style="">srit</span>/<span class="" style="">src</span>/itk4/<span class="" style="">itk</span>/Modules/Filtering/<span class="" style="">FFT</span>/include/<span class="" style="">itkFFTWHalfHermitianToRealInve</span><span class="" style="">rseFFTImageFilter</span>.<span class="" style="">hxx</span>:103:5:
required from ‘void <span class="" style="">itk</span>::<span class="" style="">FFTWHalfHermitianToRealInverse</span><span class="" style="">FFTImageFilter</span><<span class="" style="">TInputImage</span>,
<span class="" style="">TOutputImage</span>>::<span class="" style="">BeforeThreadedGenerateData</span>() [with
<span class="" style="">TInputImage</span> = <span class="" style="">itk</span>::Image<std::complex<double>, 3u>;
<span class="" style="">TOutputImage</span> = <span class="" style="">itk</span>::Image<double, 3u>]’<br>
/home/<span class="" style="">srit</span>/<span class="" style="">src</span>/<span class="" style="">rtk</span>/<span class="" style="">rtk</span>/testing/<span class="" style="">rtkdisplaceddetectortest</span>.<span class="" style="">cxx</span>:203:1: required
from here<br>
/<span class="" style="">usr</span>/lib/<span class="" style="">gcc</span>/x86_64-<span class="" style="">redhat</span>-<span class="" style="">linux</span>/4.7.2/../../../../include/c++/4.7.2/bits/<span class="" style="">stl</span>_<span class="" style="">algobase</span>.h:329:8:
<span class="" style="">erreur</span>: incompatible types in assignment of ‘const std::complex<double>’ 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 class="" style="">FFT</span>/include/<span class="" style="">itkFFTWHalfHermitianToRealInve</span><span class="" style="">rseFFTImageFilter</span>.<span class="" style="">hxx</span> b/Modules/Filtering/<span class="" style="">FFT</span>/include/<span class="" style="">itkFFTWHalfHermitianToRealInve</span><span class="" style="">rseFFTImageFilter</span>.<span class="" style="">hxx</span><br>
index 9338cb1..806d803 100644<br>
--- a/Modules/Filtering/<span class="" style="">FFT</span>/include/<span class="" style="">itkFFTWHalfHermitianToRealInve</span><span class="" style="">rseFFTImageFilter</span>.<span class="" style="">hxx</span><br>
+++ b/Modules/Filtering/<span class="" style="">FFT</span>/include/<span class="" style="">itkFFTWHalfHermitianToRealInve</span><span class="" style="">rseFFTImageFilter</span>.<span class="" style="">hxx</span><br>
@@ -100,7 +100,7 @@ <span class="" style="">FFTWHalfHermitianToRealInverse</span><span class="" style="">FFTImageFilter</span><
<span class="" style="">TInputImage</span>, <span class="" style="">TOutputImage</span> ><br>
!m_<span class="" style="">CanUseDestructiveAlgorithm</span> );<br>
if( !m_<span class="" style="">CanUseDestructiveAlgorithm</span> )<br>
{<br>
- <span class="" style="">itk</span>::algorithm::copy_n(<span class="" style="">inputPtr</span>-><span class="" style="">GetBufferPointer</span>(),
<span class="" style="">totalInputSize</span>, in);<br>
+ <span class="" style="">itk</span>::algorithm::copy_n((<span class="" style="">typename</span><span class="" style="">FFTWProxyType</span>::<span class="" style="">ComplexType</span>*)<span class="" style="">inputPtr</span>-><span class="" style="">GetBufferPointer</span>(),
<span class="" style="">totalInputSize</span>, in);<br>
}<br>
<span class="" style="">FFTWProxyType</span>::Execute( plan );<br>
</font><br>
Second, there is a missing parenthesis in the patch:<br>
<font size="1">/home/<span class="" style="">srit</span>/<span class="" style="">src</span>/itk4/lin64-<span class="" style="">dg</span>/<span class="" style="">fftwd</span>_configure_step.<span class="" style="">cmake</span>:36:<br>
Parse error. Function missing ending ")". End of file reached.<br>
<br>
</font></div>
<font>Finally, <font>the patch <font><span class="" style="">propa</span><font>gates -O3 but d<font><span class="" style="">oes</span></font> not fully fix the speed issue. A<font><span class="" style="">fter</span> a bit more digging, it turns out that sse2
instructions are not automatically ac<font><span class="" style="">tivated</span><font>. One must
<font>set <span class="" style="">FFTW</span>_OPTIMIZATION_CONFIGURATION to "--enable-sse2".
<span class="" style="">Shoul</span><font><span class="" style="">dn'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 class="" style="">
Lowekamp</span> <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank"><span class="" style="">blowekamp</span>@mail.<span class="" style="">nih</span>.gov</a>></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>
<div><br>
On Apr 12, 2013, at 12:15 PM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>> wrote:<br>
<br>
> Looking at the cmake build scripts:<br>
><br>
> <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>
><br>
> It looks like CMAKE_C_FLAGS_RELEASE is not getting passed.<br>
><br>
> I'll see if I can take this on after lunch.<br>
><br>
> Brad<br>
><br>
> On Apr 12, 2013, at 11:30 AM, Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> wrote:<br>
><br>
>> I'm not sure it's the reason: I don't expect a two fold improvement<br>
>> and the system has the same version installed, 3.3.2. Are we sure that<br>
>> the release flags are passed to FFTW? When I looked at the compilation<br>
>> log, I don't see -O3, here is an excerpt:<br>
>><br>
>> /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -std=gnu99<br>
>> -DHAVE_CONFIG_H -I.<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd<br>
>> -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align<br>
>> -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch<br>
>> -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused<br>
>> -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -MT<br>
>> cpy2d-pair.lo -MD -MP -MF .deps/cpy2d-pair.Tpo -c -o cpy2d-pair.lo<br>
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c<br>
>> libtool: compile: /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized<br>
>> -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization<br>
>> -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral<br>
>> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time<br>
>> -Wno-strict-overflow -MT cpy2d-pair.lo -MD -MP -MF<br>
>> .deps/cpy2d-pair.Tpo -c<br>
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c -o<br>
>> cpy2d-pair.o<br>
>> mv -f .deps/cpy2d-pair.Tpo .deps/cpy2d-pair.Plo<br>
>> /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -std=gnu99<br>
>> -DHAVE_CONFIG_H -I.<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd<br>
>> -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align<br>
>> -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch<br>
>> -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused<br>
>> -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -MT cpy2d.lo<br>
>> -MD -MP -MF .deps/cpy2d.Tpo -c -o cpy2d.lo<br>
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c<br>
>> libtool: compile: /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..<br>
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized<br>
>> -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization<br>
>> -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral<br>
>> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time<br>
>> -Wno-strict-overflow -MT cpy2d.lo -MD -MP -MF .deps/cpy2d.Tpo -c<br>
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c -o cpy2d.o<br>
>> mv -f .deps/cpy2d.Tpo .deps/cpy2d.Plo<br>
>><br>
>><br>
>> On Fri, Apr 12, 2013 at 5:21 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> wrote:<br>
>>> Looks like the fftw folks have made some efficiency improvements.<br>
>>><br>
>>><br>
>>><br>
>>> On Fri, Apr 12, 2013 at 11:18 AM, Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>><br>
>>> wrote:<br>
>>>><br>
>>>> I should have mentioned it: yes, it is!<br>
>>>><br>
>>>> On Fri, Apr 12, 2013 at 5:16 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
>>>> wrote:<br>
>>>>> Is your ITK built Release?<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> On Fri, Apr 12, 2013 at 11:13 AM, Simon Rit<br>
>>>>> <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>><br>
>>>>> wrote:<br>
>>>>>><br>
>>>>>> Hi,<br>
>>>>>> We have recently observed on a fedora distribution that FFTW is two<br>
>>>>>> times slower when one uses the ITK compilation<br>
>>>>>> (USE_SYSTEM_FFTW:BOOL=OFF, default) than when one uses the system fftw<br>
>>>>>> (USE_SYSTEM_FFTW:BOOL=ON).<br>
>>>>>><br>
>>>>>> We have looked for an explanation in the flags (the Fedora flags are<br>
>>>>>> available here<br>
>>>>>> <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>
>>>>>> but we have not managed to figure it out. Would someone happen to have<br>
>>>>>> an explanation and solution?<br>
>>>>>><br>
>>>>>> Thanks in advance,<br>
>>>>>> Simon<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>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> --<br>
>>>>> Unpaid intern in BillsBasement at noware dot com<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Unpaid intern in BillsBasement at noware dot com<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>
> _____________________________________<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>
_____________________________________<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>
</div>
</blockquote>
</div>
<br>
</div>
</font></font></font></font></font></font></font></font></font></font></font></div>
</div>
</div>
</span><br>
<br>
<hr>
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any
retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
<hr>
</body>
</html>