Topic
  • No replies
SystemAdmin
SystemAdmin
196 Posts

Pinned topic Very long compile times in -O2 for C++

‏2009-02-27T14:06:57Z |
Got this question over on the Linux on Power developerworks forum...

Running on sles 10 sp1, power 5 system, xlc ver 9.0 ...

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=252961

date ; xlC_r -I./include -I../idl -O2 -g -q64 -qminimaltoc -qpic -D_REENTRANT -D_GNU_SOURCE -c ir.cc -o ir.o -qmaxmem=-1 ; date

which results in...
Thu Feb 26 17:50:13 CET 2009

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::AbstractInterfaceDef> *,std::vector<ObjVar<CORBA::AbstractInterfaceDef>,std::allocator<ObjVar<CORBA::AbstractInterfaceDef> > > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > > >(__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >, __normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >, __false_type) could not be inlined into std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > >::operator=(*const* vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > &).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::LocalInterfaceDef> *,std::vector<ObjVar<CORBA::LocalInterfaceDef>,std::allocator<ObjVar<CORBA::LocalInterfaceDef> > > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > > >(__normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > >, __normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > > >(__normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > >, __normal_iterator<CORBA::Container::Description *,std::vector<CORBA::Container::Description,std::allocator<CORBA::Container::Description> > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > > >(__normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > >, __normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > > >(__normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > >, __normal_iterator<ObjVar<CORBA::ValueDef> *,std::vector<ObjVar<CORBA::ValueDef>,std::allocator<ObjVar<CORBA::ValueDef> > > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > > >(__normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > >, __normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > > >(__normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > >, __normal_iterator<CORBA::String_var *,std::vector<CORBA::String_var,std::allocator<CORBA::String_var> > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > > >(__normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > >, __normal_iterator<ObjVar<CORBA::InterfaceDef> *,std::vector<ObjVar<CORBA::InterfaceDef>,std::allocator<ObjVar<CORBA::InterfaceDef> > > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > > >(__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >, __normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > > >(__normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >, __normal_iterator<ObjVar<CORBA::ExceptionDef> *,std::vector<ObjVar<CORBA::ExceptionDef>,std::allocator<ObjVar<CORBA::ExceptionDef> > > >).

1500-029: (W) WARNING: subprogram std::__destroy_aux<__gnu_cxx::__normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > > >(__normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > >, __normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > >, __false_type) could not be inlined into std::_Destroy<__gnu_cxx::__normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > > >(__normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > >, __normal_iterator<CORBA::Initializer *,std::vector<CORBA::Initializer,std::allocator<CORBA::Initializer> > >).

1501-201: (W) Maximum number of common component diagnostics, 10 has been exceeded.

Fri Feb 27 00:56:05 CET 2009
the original question on the post..

I don't understand why my source C++ code don't compile quickly in O2 optimization.

in O2 : 8 hours.
in O0 : 10 seconds.
What are the intrinsic option of O2 more than O0 ?

It's a source code that provide from the free library mico.

it's about 5000 lines.
I check with some options to suppress the inlining...
Updated on 2010-01-13T00:35:43Z at 2010-01-13T00:35:43Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: Very long compile times in -O2 for C++

    ‏2009-03-02T02:23:41Z  
    Optimization will generally increase the compiler requirements in terms of system resources and compile time. Many of the algorithms used during optimization are exponential in nature, so very large translation units may introduce this type of issues. Something to note with C++ is that due to template instantiation or inlining, the amount of code the compiler must optimize may not be proportional to the size of the source file being compiled.

    Generally, the strategy to enable optimization in this type of situations is to split the file into multiple smaller files. I realize that this may not be feasible on all situations, and I must admit that these numbers seem extreme, so if you want to pursue this further please get in contact with IBM service to determine exactly what may be happening on this specific situation.
    Updated on 2009-03-02T02:23:41Z at 2009-03-02T02:23:41Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: Very long compile times in -O2 for C++

    ‏2009-11-24T04:09:53Z  
    Optimization will generally increase the compiler requirements in terms of system resources and compile time. Many of the algorithms used during optimization are exponential in nature, so very large translation units may introduce this type of issues. Something to note with C++ is that due to template instantiation or inlining, the amount of code the compiler must optimize may not be proportional to the size of the source file being compiled.

    Generally, the strategy to enable optimization in this type of situations is to split the file into multiple smaller files. I realize that this may not be feasible on all situations, and I must admit that these numbers seem extreme, so if you want to pursue this further please get in contact with IBM service to determine exactly what may be happening on this specific situation.

    You can also try -qtempinc -qtempmax=X, where X is some large number > 1 e.g.
    "-qtempinc -qtempmax=50"
    See XLC C++ large compilation times when using -O2 and up
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: Very long compile times in -O2 for C++

    ‏2010-01-13T00:35:43Z  

    You can also try -qtempinc -qtempmax=X, where X is some large number > 1 e.g.
    "-qtempinc -qtempmax=50"
    See XLC C++ large compilation times when using -O2 and up
    Just discovered that -qtempinc is a rather archaic option, and-qtemplateregistry is prefered.