Skip to content

Commit

Permalink
add nvtx as as variant to ICON
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Jucker committed Aug 22, 2024
1 parent 061466f commit 2b4278c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions repos/c2sm/packages/icon/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class Icon(AutotoolsPackage, CudaPackage):
'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')

# verbosity
variant('silent-rules',
default=True,
Expand Down Expand Up @@ -279,6 +281,11 @@ class Icon(AutotoolsPackage, CudaPackage):

conflicts('+loop-exchange', when='gpu=openacc+cuda')

# nvtx is only supported for nvhpc
conflicts('+nvtx', when='%cce')
conflicts('+nvtx', when='%gcc')
conflicts('+nvtx', when='%intel')

# Flag to mark if we build out-of-source
# Needed to trigger sync of input files for experiments
out_of_source_build = False
Expand Down Expand Up @@ -526,6 +533,10 @@ def configure_args(self):
if '+pytorch' in self.spec:
libs += self.spec['pytorch-fortran'].libs

if '+nvtx' in self.spec:
flags['FCFLAGS'].append('-D_USE_NVTX')
flags['LIBS'].append('-lnvhpcwrapnvtx')

fcgroup = self.spec.variants['fcgroup'].value
# ('none',) is the values spack assign if fcgroup is not set
if fcgroup != ('none', ):
Expand Down

0 comments on commit 2b4278c

Please sign in to comment.