spack/var/spack/repos/builtin/packages/bolt/package.py
Tom Scogland 18c2f1a57a
refactor: packages import spack.package explicitly (#30404)
Explicitly import package utilities in all packages, and corresponding fallout.

This includes:

* rename `spack.package` to `spack.package_base`
* rename `spack.pkgkit` to `spack.package`
* update all packages in builtin, builtin_mock and tutorials to include `from spack.package import *`
* update spack style
  * ensure packages include the import
  * automatically add the new import and remove any/all imports of `spack` and `spack.pkgkit`
    from packages when using `--fix`
  * add support for type-checking packages with mypy when SPACK_MYPY_CHECK_PACKAGES
    is set in the environment
* fix all type checking errors in packages in spack upstream
* update spack create to include the new imports
* update spack repo to inject the new import, injection persists to allow for a deprecation period

Original message below:
 
As requested @adamjstewart, update all packages to use pkgkit.  I ended up using isort to do this,
so repro is easy:

```console
$ isort -a 'from spack.pkgkit import *' --rm 'spack' ./var/spack/repos/builtin/packages/*/package.py
$ spack style --fix
```

There were several line spacing fixups caused either by space manipulation in isort or by packages
that haven't been touched since we added requirements, but there are no functional changes in here.

* [x] add config to isort to make sure this is maintained going forward
2022-05-28 12:55:44 -04:00

84 lines
3.1 KiB
Python

# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from llnl.util import tty
from spack.package import *
class Bolt(CMakePackage):
"""BOLT targets a high-performing OpenMP implementation,
especially specialized for fine-grain parallelism. Unlike other
OpenMP implementations, BOLT utilizes a lightweight threading
model for its underlying threading mechanism. It currently adopts
Argobots, a new holistic, low-level threading and tasking runtime,
in order to overcome shortcomings of conventional OS-level
threads. The current BOLT implementation is based on the OpenMP
runtime in LLVM, and thus it can be used with LLVM/Clang, Intel
OpenMP compiler, and GCC."""
homepage = "https://www.bolt-omp.org/"
url = "https://github.com/pmodels/bolt/releases/download/v1.0b1/bolt-1.0b1.tar.gz"
git = "https://github.com/pmodels/bolt.git"
maintainers = ['shintaro-iwasaki']
tags = ['e4s']
version("main", branch="main")
version("2.0", sha256="f84b6a525953edbaa5d28748ef3ab172a3b6f6899b07092065ba7d1ccc6eb5ac")
version("1.0.1", sha256="769e30dfc4042cee7ebbdadd23cf08796c03bcd8b335f516dc8cbc3f8adfa597")
version("1.0", sha256="1c0d2f75597485ca36335d313a73736594e75c8a36123c5a6f54d01b5ba5c384")
test_requires_compiler = True
depends_on('argobots')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
def cmake_args(self):
spec = self.spec
options = [
'-DLIBOMP_USE_ARGOBOTS=on',
'-DLIBOMP_ARGOBOTS_INSTALL_DIR=' + spec['argobots'].prefix
]
return options
@run_after('install')
def cache_test_sources(self):
"""Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(['examples'])
def run_sample_nested_example(self):
"""Run stand alone test: sample_nested"""
test_dir = join_path(self.test_suite.current_test_cache_dir, 'examples')
exe = 'sample_nested'
source_file = 'sample_nested.c'
if not os.path.isfile(join_path(test_dir, source_file)):
tty.warn('Skipping bolt test:'
'{0} does not exist'.format(source_file))
return
self.run_test(exe=os.environ['CXX'],
options=['-L{0}'.format(self.prefix.lib),
'-I{0}'.format(self.prefix.include),
'{0}'.format(join_path(test_dir, source_file)),
'-o', exe, '-lomp', '-lbolt'],
purpose='test: compile {0} example'.format(exe),
work_dir=test_dir)
self.run_test(exe,
purpose='test: run {0} example'.format(exe),
work_dir=test_dir)
def test(self):
self.run_sample_nested_example()