diff options
-rw-r--r-- | var/spack/repos/builtin/packages/likwid/package.py | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/likwid/package.py b/var/spack/repos/builtin/packages/likwid/package.py index 9aa6045328..a019a857d7 100644 --- a/var/spack/repos/builtin/packages/likwid/package.py +++ b/var/spack/repos/builtin/packages/likwid/package.py @@ -35,14 +35,17 @@ class Likwid(Package): patch('https://github.com/RRZE-HPC/likwid/commit/d2d0ef333b5e0997d7c80fc6ac1a473b5e47d084.patch', sha256='636cbf40669261fdb36379d67253be2b731cfa7b6d610d232767d72fbdf08bc0', when='@4.3.4') patch('https://github.com/RRZE-HPC/likwid/files/5341379/likwid-lua5.1.patch.txt', sha256='bc56253c1e3436b5ba7bf4c5533d0391206900c8663c008f771a16376975e416', when='@5.0.2^lua@5.1') variant('fortran', default=True, description='with fortran interface') + variant('cuda', default=False, description='with Nvidia GPU profiling support') # NOTE: There is no way to use an externally provided hwloc with Likwid. # The reason is that the internal hwloc is patched to contain extra # functionality and functions are prefixed with "likwid_". + # Note: extra functionality was included in upstream hwloc depends_on('lua', when='@:4') depends_on('lua@5.2:', when='@5:5.0.1') depends_on('lua', when='@5.0.2:') + depends_on('cuda', when='@5: +cuda') # TODO: check # depends_on('gnuplot', type='run') @@ -56,6 +59,13 @@ class Likwid(Package): filter_file('^#!/usr/bin/perl -w', '#!/usr/bin/env perl', *files) filter_file('^#!/usr/bin/perl', '#!/usr/bin/env perl', *files) + def setup_run_environment(self, env): + if "+cuda" in self.spec: + libs = find_libraries('libcupti', root=self.spec['cuda'].prefix, + shared=True, recursive=True) + for lib in libs.directories: + env.append_path('LD_LIBRARY_PATH', lib) + @run_before('install') def filter_sbang(self): # Filter sbang before install so Spack's sbang hook can fix it up @@ -107,15 +117,35 @@ class Likwid(Package): 'FORTRAN_INTERFACE = true', 'config.mk') if self.compiler.name == 'gcc': - filter_file('ifort', 'gfortran', - join_path('make', 'include_GCC.mk')) - filter_file('-module', '-I', join_path('make', - 'include_GCC.mk')) + makepath = join_path('make', 'include_GCC.mk') + filter_file('ifort', 'gfortran', makepath) + filter_file('-module', '-I', makepath) else: filter_file('^FORTRAN_INTERFACE .*', 'FORTRAN_INTERFACE = false', 'config.mk') + if "+cuda" in self.spec: + filter_file('^NVIDIA_INTERFACE.*', + 'NVIDIA_INTERFACE = true', + 'config.mk') + filter_file('^BUILDAPPDAEMON.*', + 'BUILDAPPDAEMON = true', + 'config.mk') + cudainc = spec['cuda'].prefix.include + filter_file('^CUDAINCLUDE.*', + 'CUDAINCLUDE = {0}'.format(cudainc), + 'config.mk') + cuptihead = HeaderList(find(spec['cuda'].prefix, 'cupti.h', + recursive=True)) + filter_file('^CUPTIINCLUDE.*', + 'CUPTIINCLUDE = {0}'.format(cuptihead.directories[0]), + 'config.mk') + else: + filter_file('^NVIDIA_INTERFACE.*', + 'NVIDIA_INTERFACE = false', + 'config.mk') + if spec.satisfies('^lua'): filter_file('^#LUA_INCLUDE_DIR.*', 'LUA_INCLUDE_DIR = {0}'.format( |