Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctly pass down optimization flags in CP2K easyblock #1293

Merged
merged 1 commit into from
Dec 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions easybuild/easyblocks/c/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def configure_step(self):
if self.cfg['extracflags']:
self.log.info("Using extra CFLAGS: %s" % self.cfg['extracflags'])
if self.cfg['extradflags']:
self.log.info("Using extra CFLAGS: %s" % self.cfg['extradflags'])
self.log.info("Using extra DFLAGS: %s" % self.cfg['extradflags'])

# lib(x)smm support
libsmm = get_software_root('libsmm')
Expand Down Expand Up @@ -335,13 +335,11 @@ def configure_common(self):
if not mpi2:
raise EasyBuildError("CP2K needs MPI-2, no known MPI-2 supporting library loaded?")

# pick up optarch value from toolchain, when optarch toolchain option is enabled or --optarch=GENERIC is used
optarch = ''
if self.toolchain.options.get('optarch', False) or build_option('optarch') == OPTARCH_GENERIC:
# take into account that a '-' is missing for the first compiler flag, but also that optarch may be empty
if self.toolchain.options.option('optarch'):
optarch = '-%s' % self.toolchain.options.option('optarch')

cppflags = os.getenv('CPPFLAGS')
ldflags = os.getenv('LDFLAGS')
cflags = os.getenv('CFLAGS')
fflags = os.getenv('FFLAGS')
fflags_lowopt = re.sub('-O[0-9]', '-O1', fflags)
options = {
'CC': os.getenv('MPICC'),
'CPP': '',
Expand All @@ -356,15 +354,14 @@ def configure_common(self):
'FCFLAGS': '$(FCFLAGS%s)' % optflags,
'FCFLAGS2': '$(FCFLAGS%s)' % regflags,

'CFLAGS': ' %s %s $(FPIC) $(DEBUG) %s ' % (os.getenv('CPPFLAGS'), os.getenv('LDFLAGS'),
self.cfg['extracflags']),
'CFLAGS': ' %s %s %s $(FPIC) $(DEBUG) %s ' % (cflags, cppflags, ldflags, self.cfg['extracflags']),
'DFLAGS': ' -D__parallel -D__BLACS -D__SCALAPACK -D__FFTSG %s' % self.cfg['extradflags'],

'LIBS': os.getenv('LIBS', ''),

'FCFLAGSNOOPT': '$(DFLAGS) $(CFLAGS) -O0 $(FREE) $(FPIC) $(DEBUG)',
'FCFLAGSOPT': '-O2 $(FREE) $(SAFE) $(FPIC) $(DEBUG) %s' % optarch,
'FCFLAGSOPT2': '-O1 $(FREE) $(SAFE) $(FPIC) $(DEBUG) %s' % optarch,
'FCFLAGSOPT': '%s $(FREE) $(SAFE) $(FPIC) $(DEBUG)' % fflags,
'FCFLAGSOPT2': '%s $(FREE) $(SAFE) $(FPIC) $(DEBUG)' % fflags_lowopt,
}

libint = get_software_root('LibInt')
Expand Down