Skip to content

Commit

Permalink
[WRF] Always use compiler wrappers for FFLAGS/FCFLAGS (spack#38470)
Browse files Browse the repository at this point in the history
`FFLAGS` and `FCFLAGS` are being ignored by WRF build system. Not only in version
`3.9.1.1`, but also `4.x`.

Also, I see no reason to explicitly add `-w` and `-O2` to compile lines when
using `gcc@10:`. Tested for version `3.9.1.1`, `4.2.2`, & `4.5.0`.

Tagging original authors of this part @MichaelLaufer and @giordano in case they
want to chime in.
  • Loading branch information
stephenmsachs authored Jun 20, 2023
1 parent 05dd240 commit 0eec7c5
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions var/spack/repos/builtin/packages/wrf/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,6 @@ def setup_build_environment(self, env):
env.set("JASPERINC", self.spec["jasper"].prefix.include)
env.set("JASPERLIB", self.spec["jasper"].prefix.lib)

# These flags should be used also in v3, but FCFLAGS/FFLAGS aren't used
# consistently in that version of WRF, so we have to force them through
# `flag_handler` below.
if self.spec.satisfies("@4.0: %gcc@10:"):
args = "-w -O2 -fallow-argument-mismatch -fallow-invalid-boz"
env.set("FCFLAGS", args)
env.set("FFLAGS", args)

if self.spec.satisfies("%aocc"):
env.set("WRFIO_NCD_LARGE_FILE_SUPPORT", 1)
env.set("HDF5", self.spec["hdf5"].prefix)
Expand All @@ -257,10 +249,9 @@ def setup_build_environment(self, env):
env.set("ADIOS2", self.spec["adios2"].prefix)

def flag_handler(self, name, flags):
# Same flags as FCFLAGS/FFLAGS above, but forced through the compiler
# wrapper when compiling v3.9.1.1.
if self.spec.satisfies("@3.9.1.1 %gcc@10:") and name == "fflags":
flags.extend(["-w", "-O2", "-fallow-argument-mismatch", "-fallow-invalid-boz"])
# Force FCFLAGS/FFLAGS by adding directly into spack compiler wrappers.
if self.spec.satisfies("@3.9.1.1: %gcc@10:") and name == "fflags":
flags.extend(["-fallow-argument-mismatch", "-fallow-invalid-boz"])
return (flags, None, None)

def patch(self):
Expand Down

0 comments on commit 0eec7c5

Please sign in to comment.