diff options
author | Jonathan R. Madsen <jrmadsen@users.noreply.github.com> | 2020-04-29 06:19:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 08:19:17 -0500 |
commit | 39bbe8f9d489e2e53a857b725b5d88236e54fee6 (patch) | |
tree | 9e528a3aa0e10df6f6389c69b71f45fed7dcf97a | |
parent | 97e67b385c03378868d84a0e2d90c337ebf3ba0d (diff) | |
download | spack-39bbe8f9d489e2e53a857b725b5d88236e54fee6.tar.gz spack-39bbe8f9d489e2e53a857b725b5d88236e54fee6.tar.bz2 spack-39bbe8f9d489e2e53a857b725b5d88236e54fee6.tar.xz spack-39bbe8f9d489e2e53a857b725b5d88236e54fee6.zip |
Update timemory to support new dependencies and expose more build options (#16241)
* Update timemory/package.py to support new dependencies and expose more build options
* Added missing 'use_arch' option handling
* Fixes for python 2.6
* Fix pyflake error F632
* F632 flake fixes
* Update package.py
* Update package.py
* 80 char width + added extra conflicts + fixed kokkos_modules reference
* 79 char width
* Removed submodule builds
- added allinea_map variant
- disabled caliper by default
- added ompt_{standalone,llvm} variants
* flake8 updates
* 79 char width
-rw-r--r-- | var/spack/repos/builtin/packages/timemory/package.py | 200 |
1 files changed, 143 insertions, 57 deletions
diff --git a/var/spack/repos/builtin/packages/timemory/package.py b/var/spack/repos/builtin/packages/timemory/package.py index 53dada7f34..8561ca07f3 100644 --- a/var/spack/repos/builtin/packages/timemory/package.py +++ b/var/spack/repos/builtin/packages/timemory/package.py @@ -6,6 +6,7 @@ # ---------------------------------------------------------------------------- from spack import * +from sys import platform class Timemory(CMakePackage): @@ -22,18 +23,70 @@ class Timemory(CMakePackage): version('3.0.0', commit='b36b1673b2c6b7ff3126d8261bef0f8f176c7beb', submodules=True) + linux = False if platform == 'darwin' else True + + variant('shared', default=True, description='Build shared libraries') + variant('static', default=False, description='Build static libraries') variant('python', default=True, description='Enable Python support') - variant('mpi', default=False, description='Enable MPI support') - variant('tau', default=True, description='Enable TAU support') - variant('papi', default=True, description='Enable PAPI support') - variant('cuda', default=True, description='Enable CUDA support') - variant('cupti', default=True, description='Enable CUPTI support') + variant('mpi', default=True, description='Enable MPI support') + variant('tau', default=False, description='Enable TAU support') + variant('papi', default=linux, description='Enable PAPI support') + variant('cuda', default=linux, description='Enable CUDA support') + variant('cupti', default=linux, description='Enable CUPTI support') + variant('tools', default=True, description='Build/install extra tools') + variant('vtune', default=False, description='Enable VTune support') variant('upcxx', default=False, description='Enable UPC++ support') - variant('gotcha', default=True, description='Enable GOTCHA support') - variant('likwid', default=True, description='Enable LIKWID support') - variant('caliper', default=True, description='Enable Caliper support') + variant('gotcha', default=linux, description='Enable GOTCHA support') + variant('likwid', default=linux, description='Enable LIKWID support') + variant('caliper', default=False, description='Enable Caliper support') + variant('dyninst', default=linux, + description='Build dynamic instrumentation tools') + variant('examples', default=False, description='Build/install examples') variant('gperftools', default=True, description='Enable gperftools support') + variant('kokkos_tools', default=True, + description=('Build generic kokkos-tools libraries, e.g. ' + 'kp_timemory, kp_timemory_filter')) + variant('kokkos_build_config', default=False, + description=('Build pre-configured (i.e. dedicated) kokkos-tools ' + 'libraries, e.g. kp_timemory_cpu_flops')) + variant('cuda_arch', default='auto', description='CUDA architecture name', + values=('auto', 'kepler', 'tesla', 'maxwell', 'pascal', + 'volta', 'turing'), multi=False) + variant('cpu_target', default='auto', + description=('Build for specific cpu architecture (specify ' + 'cpu-model)')) + variant('use_arch', default=False, + description=('Build all of timemory w/ cpu_target architecture ' + 'flags (default: roofline toolkit only)')) + variant('tls_model', default='global-dynamic', + description='Thread-local static model', multi=False, + values=('global-dynamic', 'local-dynamic', 'initial-exec', + 'local-exec')) + variant('lto', default=False, + description='Build w/ link-time optimization') + variant('statistics', default=True, + description=('Build components w/ support for statistics ' + '(min/max/stddev)')) + variant('extra_optimizations', default=True, + description='Build timemory with extra optimization flags') + variant('cxxstd', default='14', description='C++ language standard', + values=('14', '17', '20'), multi=False) + variant('mpip_library', default=linux, + description='Build stand-alone timemory-mpip GOTCHA library') + variant('ompt', default=True, description=('Enable OpenMP tools support')) + variant('ompt_standalone', default=True, + description=('Enable OpenMP tools support via drop-in ' + 'replacement of libomp/libgomp/libiomp5')) + variant('ompt_llvm', default=False, + description='Enable OpenMP tools support as part of llvm build') + variant('ompt_library', default=True, + description='Build stand-alone timemory-ompt library') + variant('allinea_map', default=False, + description='Enable Allinea ARM-MAP support') + variant('require_packages', default=False, + description=('find_package(...) resulting in NOTFOUND ' + 'generates error')) depends_on('cmake@3.11:', type='build') @@ -48,77 +101,110 @@ class Timemory(CMakePackage): depends_on('cuda', when='+cuda') depends_on('cuda', when='+cupti') depends_on('upcxx', when='+upcxx') - depends_on('gotcha', when='+gotcha') depends_on('likwid', when='+likwid') + depends_on('gotcha', when='+gotcha') depends_on('caliper', when='+caliper') + depends_on('dyninst', when='+dyninst') depends_on('gperftools', when='+gperftools') + depends_on('intel-parallel-studio', when='+vtune') + depends_on('llvm-openmp-ompt+standalone', when='+ompt_standalone') + depends_on('llvm-openmp-ompt~standalone', when='+ompt_llvm') + depends_on('arm-forge', when='+allinea_map') + conflicts('+python', when='~shared', + msg='+python requires building shared libraries') conflicts('+cupti', when='~cuda', msg='CUPTI requires CUDA') + conflicts('+kokkos_tools', when='~tools', + msg='+kokkos_tools requires +tools') + conflicts('+kokkos_build_config', when='~tools', + msg='+kokkos_build_config requires +tools') + conflicts('+kokkos_build_config', when='~kokkos_tools', + msg='+kokkos_build_config requires +kokkos_tools') + conflicts('tls_model=local-dynamic', when='+python', + msg='+python require tls_model=global-dynamic') + conflicts('tls_model=initial-exec', when='+python', + msg='+python require tls_model=global-dynamic') + conflicts('tls_model=local-exec', when='+python', + msg='+python require tls_model=global-dynamic') + conflicts('+mpip_library', when='~mpi', msg='+mpip_library requires +mpi') + conflicts('+mpip_library', when='~gotcha', + msg='+mpip_library requires +gotcha') + conflicts('+mpip_library', when='~shared', + msg='+mpip_library requires building shared libraries') + conflicts('+ompt_standalone', when='~ompt', + msg='+ompt_standalone requires +ompt') + conflicts('+ompt_llvm', when='~ompt', + msg='+ompt_llvm requires +ompt') + conflicts('+ompt_library', when='~ompt', + msg='+ompt_library requires +ompt') + conflicts('+ompt_library', when='~shared~static', + msg='+ompt_library requires building shared or static libraries') + conflicts('+ompt_standalone+ompt_llvm', + msg=('+ompt_standalone and +ompt_llvm are not compatible. Use ' + '+ompt_llvm~ompt_standalone if building LLVM, use ' + '~ompt_llvm+ompt_standalone if ompt.h is not provided by ' + 'the compiler')) def cmake_args(self): spec = self.spec - # Use spack install of Caliper and/or GOTCHA - # instead of internal submodule build args = [ - '-DTIMEMORY_BUILD_GOTCHA=OFF', - '-DTIMEMORY_BUILD_CALIPER=OFF', - '-DTIMEMORY_BUILD_TOOLS=ON', + '-DTIMEMORY_BUILD_PYTHON=ON', '-DTIMEMORY_BUILD_TESTING=OFF', - '-DTIMEMORY_BUILD_EXTRA_OPTIMIZATIONS=ON', '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON', ] + cxxstd = spec.variants['cxxstd'].value + args.append('-DCMAKE_CXX_STANDARD={0}'.format(cxxstd)) + + tls = spec.variants['tls_model'].value + args.append('-DTIMEMORY_TLS_MODEL={0}'.format(tls)) + if '+python' in spec: args.append('-DPYTHON_EXECUTABLE={0}'.format( spec['python'].command.path)) - args.append('-DTIMEMORY_USE_PYTHON=ON') - args.append('-DTIMEMORY_BUILD_PYTHON=ON') - args.append('-DTIMEMORY_TLS_MODEL=global-dynamic') - else: - args.append('-DTIMEMORY_USE_PYTHON=OFF') - args.append('-DTIMEMORY_BUILD_PYTHON=OFF') - - if '+caliper' in spec: - args.append('-DTIMEMORY_USE_CALIPER=ON') - else: - args.append('-DTIMEMORY_USE_CALIPER=OFF') - - if '+tau' in spec: - args.append('-DTIMEMORY_USE_TAU=ON') - else: - args.append('-DTIMEMORY_USE_TAU=OFF') - - if '+likwid' in spec: - args.append('-DTIMEMORY_USE_LIKWID=ON') - else: - args.append('-DTIMEMORY_USE_LIKWID=OFF') - - if '+papi' in spec: - args.append('-DTIMEMORY_USE_PAPI=ON') - args.append('-DPAPI_ROOT_DIR={0}'.format(spec['papi'].prefix)) - else: - args.append('-DTIMEMORY_USE_PAPI=OFF') if '+mpi' in spec: + args.append('-DTIMEMORY_USE_MPI_LINK_FLAGS=OFF') args.append('-DMPI_C_COMPILER={0}'.format(spec['mpi'].mpicc)) args.append('-DMPI_CXX_COMPILER={0}'.format(spec['mpi'].mpicxx)) - else: - args.append('-DTIMEMORY_USE_MPI=OFF') - - if '+gotcha' in spec: - args.append('-DTIMEMORY_USE_GOTCHA=ON') - else: - args.append('-DTIMEMORY_USE_GOTCHA=OFF') if '+cuda' in spec: - args.append('-DTIMEMORY_USE_CUDA=ON') - else: - args.append('-DTIMEMORY_USE_CUDA=OFF') - - if '+cupti' in spec: - args.append('-DTIMEMORY_USE_CUPTI=ON') - else: - args.append('-DTIMEMORY_USE_CUPTI=OFF') + targ = spec.variants['cuda_arch'].value + key = '' if spec.satisfies('@:3.0.1') else 'TIMEMORY_' + # newer versions use 'TIMEMORY_CUDA_ARCH' + args.append('-D{0}CUDA_ARCH={1}'.format(key, targ)) + + cpu_target = spec.variants['cpu_target'].value + if cpu_target == 'auto': + args.append('-DCpuArch_TARGET={0}'.format(cpu_target)) + + # forced disabling of submodule builds + for dep in ('caliper', 'gotcha', 'ompt'): + args.append('-DTIMEMORY_BUILD_{0}=OFF'.format(dep.upper())) + + # spack options which translate to TIMEMORY_<OPTION> + for dep in ('require_packages', 'kokkos_build_config', 'use_arch'): + args.append('-DTIMEMORY_{0}={1}'.format( + dep.upper(), 'ON' if '+{0}'.format(dep) in spec else 'OFF')) + + # spack options which translate to BUILD_<OPTION>_LIBS + for dep in ('shared', 'static'): + args.append('-DBUILD_{0}_LIBS={1}'.format( + dep.upper(), 'ON' if '+{0}'.format(dep) in spec else 'OFF')) + + # spack options which translate to TIMEMORY_BUILD_<OPTION> + for dep in ('tools', 'examples', 'kokkos_tools', 'lto', + 'extra_optimizations', 'mpip_library', 'ompt_library'): + args.append('-DTIMEMORY_BUILD_{0}={1}'.format( + dep.upper(), 'ON' if '+{0}'.format(dep) in spec else 'OFF')) + + # spack options which translate to TIMEMORY_USE_<OPTION> + for dep in ('allinea_map', 'python', 'mpi', 'tau', 'papi', 'ompt', + 'cuda', 'cupti', 'cupti', 'vtune', 'upcxx', 'gotcha', + 'likwid', 'caliper', 'dyninst', 'gperftools', + 'statistics'): + args.append('-DTIMEMORY_USE_{0}={1}'.format( + dep.upper(), 'ON' if '+{0}'.format(dep) in spec else 'OFF')) return args |