[gmx-developers] Turning off optimization

Erik Lindahl lindahl at cbr.su.se
Wed Jul 1 10:31:34 CEST 2009

On Jul 1, 2009, at 10:25 AM, Mark Abraham wrote:

> David van der Spoel wrote:
>> Hi,
>> how do I turn off optimization when compiling gromacs, now that it  
>> has become much more difficult to use CFLAGS, CXXFLAGS etc.?
>> --disable-cpu-optimization drops the optimization from -03 to 02,  
>> but I don't want any optimization (not just for debugging but  
>> because my code does not compile otherwise).

That is compiler-dependent, so you'll have to create your own CFLAGS  
string. I can't imagine it *that* difficult to cut-and-paste the  
default CFLAGS you see for a compile and then add "-O0".

If your code doesn't compile with -O2, I would definitely say you need  
debugging ;-)

> Sounds like whatever mechanism is being used by --disable-cpu- 
> optimization should be used by a new option --disable-all- 
> optimization as well. Why is CFLAGS now harder to use?

Not all compilers support ISO C99 by default (not mandatory, but we  
try to use it when possible), and there might be some code temporarily  
that requires SSE intrinsics support on x86...

--disable-cpu-optimization is quite a bit different; this option tries  
to find optimizations for the actual *CPU* you are using by checking  
cache sizes, architecture (e.g. Power6-specific, won't work on  
Power5+, etc.). Disabling means we don't try this. There is no  
standard way to disable all optimizations for all compilers, so I'd  
rather not give the user the impression it is disabled just because  
they use such an option!



Erik Lindahl   <lindahl at cbr.su.se>  Backup: <erik.lindahl at gmail.com>
Associate Professor, Computational Structural Biology
Center for Biomembrane Research, Dept. Biochemistry & Biophysics
Stockholm University, SE-106 91 Stockholm, Sweden
Tel: +46(0)8164675  Mobile: +46(0)703844534  Fax: mail a PDF instead

More information about the gromacs.org_gmx-developers mailing list