[Insight-developers] gcc compilation flag conflict when profiling with gprof

gang song songgang97 at gmail.com
Fri Aug 5 13:59:23 EDT 2011


Sorry for replying late. Yes, I want to profile ITK, not HDF5.

To keep best effort in tracking HDF5 release, I wonder if there is a
good way to script CMakeLists.txt, to find if "-pg" is turned on in
the active compiling/linking flags? It would be great if you could
point me to some references.


Thanks

-Gang


On Thu, Jul 28, 2011 at 1:09 PM, Brad King <brad.king at kitware.com> wrote:
> On 07/28/2011 12:17 PM, Williams, Norman K wrote:
>> We're tracking the HDF5 releases, so that bit of silliness is actually in
>> a third party CMakeLists.txt, I think.The HDF group is very concerned with
>> performance, since HDF is used on gigantic datasets, so they probably
>> stuck this in, thinking it would be faster.
>
> I think it is safe to remove -fomit-frame-pointer from ITK's distribution
> of HDF5, at least optionally.  One may just commit the change like any
> other in ITK.
>
> -Brad
>
>
>> We already have to turn off -fopenmp in order for HDF5 to link properly on
>> OS X, so I think we should remove -pg at the same time.  You want to
>> profile ITK, not HDF5, right?
>>
>> On 7/25/11 3:54 PM, "gang song" <songgang97 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I am trying to profile ITK codes using gprof in Linux, which needs to
>>> add flag -pg in gcc compilation and linking. However, -pg conflicts
>>> with -fomit-frame-pointer.  Here is what I added in ccmake:
>>> CMAKE_CXX_FLAGS                  -pg
>>> CMAKE_C_FLAGS                    -pg
>>> CMAKE_EXE_LINKER_FLAGS           -pg
>>>
>>>
>>> [ 44%] Building C object
>>> Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeFiles/H5make_libsettings.dir/
>>> H5make_libsettings.c.o
>>> gcc: -pg and -fomit-frame-pointer are incompatible
>>> make[3]: ***
>>> [Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeFiles/H5make_libsettings.dir
>>> /H5make_libsettings.c.o]
>>> Error 1
>>> make[2]: ***
>>> [Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeFiles/H5make_libsettings.dir
>>> /all]
>>> Error 2
>>> make[1]: ***
>>> [Modules/Registration/Refactoring/test/CMakeFiles/ITK-RegistrationRefactor
>>> ingTestDriver.dir/rule]
>>> Error 2
>>> make: *** [ITK-RegistrationRefactoringTestDriver] Error 2
>>>
>>> -fomit-frame-pointer is used in
>>> ITK/Modules/ThirdParty/HDF5/src/itkhdf5/CMakeLists.txt, line 361. ITK
>>> compiles fine if removing it:
>>>
>>> IF (CMAKE_COMPILER_IS_GNUCC)
>>> #  SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99
>>> -fomit-frame-pointer -finline-functions -fno-common")
>>> SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99
>>> -finline-functions -fno-common")
>>> ENDIF (CMAKE_COMPILER_IS_GNUCC)
>>>
>>>
>>> Is this a good way to make "-pg" flag working?
>>>
>>>
>>> Thanks
>>>
>>> -Gang
>>> _______________________________________________
>>> 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://kitware.com/products/protraining.html
>>>
>>> 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-developers
>>
>>
>>
>> ________________________________
>> 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.
>> ________________________________
>
>


More information about the Insight-developers mailing list