[petsc-dev] COPTFLAGS

Satish Balay balay at mcs.anl.gov
Wed Nov 13 11:51:07 CST 2013


On Wed, 13 Nov 2013, Jed Brown wrote:

> Satish Balay <balay at mcs.anl.gov> writes:
> > I don't understand why this would be needed. Thid code sets the
> > defaults for bopt='g' or 'O'. But if COPTFLAGS flags is set by user -
> > it routine should not be called. [so the above 2 lines appear to be
> > redundant]
> 
> How do you figure that the routine is not called when COPTFLAGS is set
> by the user?

configureCompilerFlags() in compilerFlags.py does this magic..

>>>>>>>>>>>
        for bopt in bopts:
          if not bopt == '' and self.getOptionalFlagsName(language) in self.framework.argDB:
            # treat user supplied options as single option - as it could include options separated by spaces '-tp k8-64'                                                                                           
            flags = [self.framework.argDB[self.getOptionalFlagsName(language)]]
          elif bopt == '' and self.getCompilerFlagsName(language) in self.framework.argDB:
            self.logPrint('Ignoring default options which were overridden using --'+self.getCompilerFlagsName(language)+ ' ' + self.framework.argDB[self.getCompilerFlagsName(language)])
            flags = []
          else:
            flags = options.getCompilerFlags(language, self.setCompilers.getCompiler(), bopt)
<<<<<<<<

> (And note that the function is called twice, once with bopt='' to get
> warning flags and again with bopt in ['g', 'O'] to get
> optimization/debug flags.)

Thats how the defaults are supporsed to work.

If the user does not sepecify CFLAGS, set defaults via bopt=''. If the
user does not specify COPTFLAGS - set the defaults via bopt='g' for
debugging mode - or with bopt=O' for optimized mode.

Satish





More information about the petsc-dev mailing list