I found the flag:
it is -DNDEBUG
apparently I need to add use it I compile my application in optimized mode.
You need code in the header files because of the templates, right?

On 11/23/2016 4:20 PM, Roy Stogner wrote:
>
> On Wed, 23 Nov 2016, Michael Povolotskyi wrote:
>
>> after making compilation flags identical, it  works. Now I will 
>> change them one by one to see which one matters.
>
> Good idea.
>
>> Does this happen because of the code in header files?
>
> Yes.
>
>> If yes, is it possible to avoid code in the header files?
>
> No.
>
>> You see, I'd prefer to keep libmesh always built in optimized mode 
>> and change flags for my application only.
>
> That's probably a bad idea.  If you need to debug your application,
> libMesh can help you.  A lot of those assertions are not looking for
> internal bugs in libMesh, they're looking for bugs in application code
> using libMesh incorrectly.  That assertion you pasted earlier, for
> example, is an out-of-bounds vector access.  libMesh obviously can't
> prevent you from asking for an index which is isn't in the vector (or
> which isn't in the semilocal part of a distributed vector), and we
> don't even want to waste time checking every vector access in a
> correct code, but if you're not sure your code is correct then
> spending the extra time is worth it.
>
> It also sounds like you're under the misapprehension that building a
> dbg copy of libMesh somehow *prevents* you from keeping the opt copy?
> That's not the case.  If you configure with "METHODS='dbg devel opt'",
> for example (or with no METHODS argument at all, since those three are
> the default) then you'll get a dbg build, and a devel build, and an
> opt build, all installed to the same target directory.  You can then
> keep two builds of your application code (whether with a similar
> system, or with two out-of-source build directories for an autotools
> code), and build debug when you need that and optimized when you need
> that, with each linking to the corresponding library.
>
>> Also, I see that libmesh is using -O2 for the optimized mode. Why not 
>> -03?
>
> Honestly?  I think that's an atavism, from bad experiences with a gcc
> version that once gave us incorrect code from -O3 many years ago.
> It's probably worth changing at this point.
> ---
> Roy



------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to