Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
farhi committed Dec 7, 2023
2 parents ae67f88 + 66931db commit 633066e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/Python/mcrun/mccode.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ def x_path(file):
cflags += shlex.split( os.environ.get('LDFLAGS') )
if os.environ.get('CFLAGS'):
cflags += shlex.split( os.environ.get('CFLAGS') )
# Special handling of NVIDIA's OpenACC-aware compiler inside a CONDA env,
# remove certain unsupported flags:
if self.options.openacc and 'nvc' in mccode_config.compilation['OACC']:
Cflags = shlex.join(cflags)
Cflags=Cflags.replace('-march=nocona', '')
Cflags=Cflags.replace('-ftree-vectorize', '')
Cflags=Cflags.replace('-fstack-protector-strong', '')
Cflags=Cflags.replace('-fno-plt', '')
Cflags=Cflags.replace('-ffunction-sections', '')
Cflags=Cflags.replace('-pipe', '')
cflags=shlex.split(Cflags)

# Parse for instances of CMD() ENV() GETPATH() in the loaded CFLAG entries
cflags += [self.options.mpi and mccodelib.cflags.evaluate_dependency_str(mccode_config.compilation['MPIFLAGS'],
Expand All @@ -188,6 +199,7 @@ def x_path(file):

if not self.options.openacc:
cflags += options.no_cflags and ['-O0'] or shlex.split(mccode_config.compilation['CFLAGS']) # cflags

# Look for CFLAGS in the generated C code
ccode = open(self.cpath, 'rb')
counter = 0
Expand Down

0 comments on commit 633066e

Please sign in to comment.