[Insight-users] ITK FFTW vs system FFTW

Simon Rit simon.rit at creatis.insa-lyon.fr
Sun Apr 14 08:15:42 EDT 2013


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/itkFFTWHalfHermitianToRealInve
rseFFTImageFilter.hxx b/Modules/Filtering/FFT/include/
itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx
index 9338cb1..806d803 100644
--- a/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInve
rseFFTImageFilter.hxx
+++ b/Modules/Filtering/FFT/include/itkFFTWHalfHermitianToRealInve
rseFFTImageFilter.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((typename FFTWProxyType::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. A
fter 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>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>
> 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>
> 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>
> 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>
> >>> 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>
> >>>> wrote:
> >>>>> Is your ITK built Release?
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Apr 12, 2013 at 11:13 AM, Simon Rit
> >>>>> <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
> >>>>>>
> >>>>>> 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
> >>
> >> 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
> >
> > 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
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130414/4bc59875/attachment.htm>


More information about the Insight-users mailing list