diff --git a/repos/c2sm/packages/icon/package.py b/repos/c2sm/packages/icon/package.py index 3e8656a05e..1f711c298e 100755 --- a/repos/c2sm/packages/icon/package.py +++ b/repos/c2sm/packages/icon/package.py @@ -158,6 +158,9 @@ class Icon(SpackIcon): description="Create a Fortran compile group: GROUP;files;flag \nNote: flag can only be one single value, i.e. -O1", ) + variant("nvtx", default=False, description="Enable NVTX for profiling") + requires("%nvhpc", when="+nvtx") # NVTX is only supported for nvhpc + # verbosity variant( "silent-rules", @@ -234,6 +237,16 @@ def configure_args(self): if "+sct" in self.spec: libs += self.spec["hdf5"].libs + if "+nvtx" in self.spec: + for i, arg in enumerate(args): + if "FCFLAGS" in arg: + args[i] += " -D_USE_NVTX" + break + else: + flags["FCFLAGS"].append("-D_USE_NVTX") + + libs += LibraryList(["nvhpcwrapnvtx"]) + fcgroup = self.spec.variants["fcgroup"].value # ('none',) is the values spack assign if fcgroup is not set if fcgroup != ("none",):