[Insight-users] How to reduce the compilation time
Tim Allman
dr.tim.allman at gmail.com
Mon Mar 11 11:25:54 EDT 2013
I agree with all of the suggestions given but I think that it's worth
mentioning that templated C++ code requires much more processing than
non-templated code, partly because you can't hide anything in .cpp
files. Everything must be in headers. When the code is compiled a class
is created for every every specific type (such as pixel type) and then
these are compiled so it is easy to make very long compile times.
If I have been working with a piece of code and think that I have more
headers included than I need, I comment out the whole block and then try
to compile it. I then uncomment one by one only those necessary to allow
the code to compile.
Tim
On 13-03-11 08:43 AM, Bradley Lowekamp wrote:
> If you are gcc, you can look into "ccache" while it does not make the
> compilation go faster, it caches the output so when you compile again
> it doesn't have to do all the work. It really a huge help when you are
> moving between branches in a project like ITK or SimpleITK. I am not
> sure how much it'll help for your case.
>
> Brad
>
>
> On Mar 11, 2013, at 7:34 AM, Bill Lorensen <bill.lorensen at gmail.com
> <mailto:bill.lorensen at gmail.com>> wrote:
>
>> As you said, reduce the number of pixel types for development.
>>
>> On Mon, Mar 11, 2013 at 4:21 AM, Ariel Hernán Curiale
>> <curiale at gmail.com <mailto:curiale at gmail.com>> wrote:
>>
>> Hi Saurabh,
>>
>> Thanks four your tips. I'm using all the headers. I was thinking
>> to use only one pixel type (for develop) with the hope to reduce
>> the compiling time.
>>
>> Thank again.
>> __________________________________
>> | Ariel Hernán Curiale Ph.D Student
>> | ETSI Telecomunicación
>> | Universidad de Valladolid
>> | Campus Miguel Delibes
>> | 47011 Valladolid, Spain
>> | Phone: 983-423000 ext. 5590
>> | Web: www.curiale.com.ar <http://www.curiale.com.ar/>
>> |_________________________________
>>
>> El 11/03/2013, a las 00:50, Saurabh Garg escribió:
>>
>>> Hi Ariel,
>>> I had similar problem. There are couple of things you can do.
>>> Try to remove the ITK header files which you are not using
>>> anymore. As you mention, you are already compiling the modified
>>> files only. Try to split the code further over more
>>> files/modules, if you can. For Instance, I see, you are using
>>> different optimizers. Are you using all of them or testing the
>>> performance with different optimizer. In later case, I would
>>> protect the code with #ifdef and #endif, so that you can exclude
>>> the code/header files which you don't need for the current run.
>>> HTH,
>>> Saurabh
>>>
>>> On Sun, Mar 10, 2013 at 2:31 PM, Ariel Hernán Curiale
>>> <curiale at gmail.com <mailto:curiale at gmail.com>> wrote:
>>>
>>> Hi,
>>> .
>>> I'm looking for some tips about how can I reduce the
>>> compilation time. I created some libraries Metric1.a,
>>> Metric2.a, Metric3.a, BlockMatching.a and MyRegistration.a
>>> to compile just the modified code and not all of it.
>>>
>>> In my code, I use this main class:
>>>
>>> #include <itkSymmetricForcesDemonsRegistrationFilter.h>
>>> #include <itkMultiResolutionPDEDeformableRegistration.h>
>>> #include <itkBSplineInterpolateImageFunction.h>
>>> #include <itkMultiResolutionImageRegistrationMethod.h>
>>> #include <itkMultiResolutionPyramidImageFilter.h>
>>> #include <itkBSplineTransform.h>
>>> #include <itkRegularStepGradientDescentOptimizer.h>
>>> #include <itkLBFGSBOptimizer.h>
>>> #include <itkConjugateGradientOptimizer.h>
>>> #include <itkLinearInterpolateImageFunction.h>
>>> #include <itkInterpolateImageFunction.h>
>>> #include <itkResampleImageFilter.h>
>>> #include <itkRecursiveMultiResolutionPyramidImageFilter.h>
>>> #include <itkCovariantVector.h>
>>> #include <itkMeanSquaresImageToImageMetric.h>
>>> #include <itkBinaryDilateImageFilter.h>
>>> #include <itkResampleImageFilter.h>
>>> #include <itkExtractImageFilter.h>
>>> #include <itkWarpImageFilter.h>
>>> #include <itkMultiResolutionPDEDeformableRegistration.h>
>>> #include <itkRescaleIntensityImageFilter.h>
>>> #include <itkBinaryThresholdImageFilter.h>
>>> #include <itkImageRandomConstIteratorWithIndex.h>
>>>
>>> Also, I work with different types of pixels in 2D, 3D and 4D:
>>> unsigned char
>>> char
>>> unsigned short
>>> short
>>> unsigned int
>>> int
>>> unsigned long
>>> long
>>> float
>>> double
>>>
>>>
>>> The main problem is that the code takes too much time to
>>> compile (I use itk-4.3, vtk-5.10 and gcc 4.2). If anyone
>>> could give me some tips about how can I reduce the compiling
>>> time it would be really useful.
>>>
>>> In the CMakeList.txt I link the libraries and the main code
>>> with ${ITK_LIBRARIES} (I couldn't find the
>>> ITKRegistrationCommon library to use just this library).
>>>
>>> Regards,
>>> __________________________________
>>> | Ariel Hernán Curiale Ph.D Student
>>> | ETSI Telecomunicación
>>> | Universidad de Valladolid
>>> | Campus Miguel Delibes
>>> | 47011 Valladolid, Spain
>>> | Phone: 983-423000 ext. 5590
>>> | Web: www.curiale.com.ar <http://www.curiale.com.ar/>
>>> |_________________________________
>>>
>>>
>>> _____________________________________
>>> 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
>>
>>
>>
>>
>> --
>> 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
>
> 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
--
Tim Allman, Ph.D.
35 Margaret Street,
Guelph Ontario N1E 5R6
Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130311/1e362fa0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dr_tim_allman.vcf
Type: text/x-vcard
Size: 159 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130311/1e362fa0/attachment.vcf>
More information about the Insight-users
mailing list