[Insight-users] ITK FFTW vs system FFTW
Johnson, Hans J
hans-johnson at uiowa.edu
Sun Apr 14 08:46:28 EDT 2013
Simon,
This was posted last night into gerrit http://review.source.kitware.com/#/c/10850/3. 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).
If I do not receive a negative feedback, this morning, I will merge it yet today.
Hans
From: Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
Date: Sunday, April 14, 2013 7:15 AM
To: Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>>
Cc: insight-users <insight-users at itk.org<mailto:insight-users at itk.org>>
Subject: Re: [Insight-users] ITK FFTW vs system FFTW
Hi,
Thanks! A few things. First, going from the latest release to HEAD, I had a compilation issue:
/home/srit/src/itk4/itk/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx:103:5: required from ‘void itk::FFTWHalfHermitianToRealInverseFFTImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData() [with TInputImage = itk::Image<std::complex<double>, 3u>; TOutputImage = itk::Image<double, 3u>]’
/home/srit/src/rtk/rtk/testing/rtkdisplaceddetectortest.cxx:203:1: required from here
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algobase.h:329:8: erreur: incompatible types in assignment of ‘const std::complex<double>’ to ‘double [2]’
I fixed it with a pointer cast
diff --git a/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx
index 9338cb1..806d803 100644
--- a/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx
+++ b/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx
@@ -100,7 +100,7 @@ FFTWHalfHermitianToRealInverseFFTImageFilter< TInputImage, TOutputImage >
!m_CanUseDestructiveAlgorithm );
if( !m_CanUseDestructiveAlgorithm )
{
- itk::algorithm::copy_n(inputPtr->GetBufferPointer(), totalInputSize, in);
+ itk::algorithm::copy_n((typenameFFTWProxyType::ComplexType*)inputPtr->GetBufferPointer(), totalInputSize, in);
}
FFTWProxyType::Execute( plan );
Second, there is a missing parenthesis in the patch:
/home/srit/src/itk4/lin64-dg/fftwd_configure_step.cmake:36:
Parse error. Function missing ending ")". End of file reached.
Finally, the patch propagates -O3 but does not fully fix the speed issue. After a bit more digging, it turns out that sse2 instructions are not automatically activated. One must set FFTW_OPTIMIZATION_CONFIGURATION to "--enable-sse2". Shouldn't this be done automatically? Setting it fixed the compilation time.
Thanks again for your help,
Simon
On Fri, Apr 12, 2013 at 8:27 PM, Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
Hello,
I have placed a patch on gerrit for review:
http://review.source.kitware.com/#/c/10848/
Please let us know if works for you.
Brad
On Apr 12, 2013, at 12:15 PM, Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
> Looking at the cmake build scripts:
>
> https://github.com/Kitware/ITK/blob/master/CMake/itkExternal_FFTW.cmake#L44
>
> It looks like CMAKE_C_FLAGS_RELEASE is not getting passed.
>
> I'll see if I can take this on after lunch.
>
> Brad
>
> On Apr 12, 2013, at 11:30 AM, Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>> wrote:
>
>> I'm not sure it's the reason: I don't expect a two fold improvement
>> and the system has the same version installed, 3.3.2. Are we sure that
>> the release flags are passed to FFTW? When I looked at the compilation
>> log, I don't see -O3, here is an excerpt:
>>
>> /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -std=gnu99
>> -DHAVE_CONFIG_H -I.
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd
>> -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align
>> -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch
>> -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused
>> -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -MT
>> cpy2d-pair.lo -MD -MP -MF .deps/cpy2d-pair.Tpo -c -o cpy2d-pair.lo
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c
>> libtool: compile: /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized
>> -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization
>> -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral
>> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time
>> -Wno-strict-overflow -MT cpy2d-pair.lo -MD -MP -MF
>> .deps/cpy2d-pair.Tpo -c
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d-pair.c -o
>> cpy2d-pair.o
>> mv -f .deps/cpy2d-pair.Tpo .deps/cpy2d-pair.Plo
>> /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -std=gnu99
>> -DHAVE_CONFIG_H -I.
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd
>> -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align
>> -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch
>> -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused
>> -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -MT cpy2d.lo
>> -MD -MP -MF .deps/cpy2d.Tpo -c -o cpy2d.lo
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c
>> libtool: compile: /usr/bin/cc -std=gnu99 -DHAVE_CONFIG_H -I.
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel -I..
>> -I/home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/simd -Wno-uninitialized
>> -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization
>> -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral
>> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time
>> -Wno-strict-overflow -MT cpy2d.lo -MD -MP -MF .deps/cpy2d.Tpo -c
>> /home/srit/src/itk4/lin64-dg/fftwd/src/fftwd/kernel/cpy2d.c -o cpy2d.o
>> mv -f .deps/cpy2d.Tpo .deps/cpy2d.Plo
>>
>>
>> On Fri, Apr 12, 2013 at 5:21 PM, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>> wrote:
>>> Looks like the fftw folks have made some efficiency improvements.
>>>
>>>
>>>
>>> On Fri, Apr 12, 2013 at 11:18 AM, Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
>>> wrote:
>>>>
>>>> I should have mentioned it: yes, it is!
>>>>
>>>> On Fri, Apr 12, 2013 at 5:16 PM, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>>
>>>> wrote:
>>>>> Is your ITK built Release?
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Apr 12, 2013 at 11:13 AM, Simon Rit
>>>>> <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>> We have recently observed on a fedora distribution that FFTW is two
>>>>>> times slower when one uses the ITK compilation
>>>>>> (USE_SYSTEM_FFTW:BOOL=OFF, default) than when one uses the system fftw
>>>>>> (USE_SYSTEM_FFTW:BOOL=ON).
>>>>>>
>>>>>> We have looked for an explanation in the flags (the Fedora flags are
>>>>>> available here
>>>>>> http://pkgs.fedoraproject.org/cgit/fftw.git/tree/fftw.spec)
>>>>>> but we have not managed to figure it out. Would someone happen to have
>>>>>> an explanation and solution?
>>>>>>
>>>>>> Thanks in advance,
>>>>>> Simon
>>>>>> _____________________________________
>>>>>> Powered by www.kitware.com<http://www.kitware.com>
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>>> http://www.kitware.com/products/protraining.php
>>>>>>
>>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>> _____________________________________
>> Powered by www.kitware.com<http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>
> _____________________________________
> Powered by www.kitware.com<http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users
________________________________
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.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130414/a3db7d65/attachment.htm>
More information about the Insight-users
mailing list