parent
3268cf4b96
commit
7f003a77dd
@ -12,6 +12,9 @@ class Nsimd(CMakePackage):
|
||||
|
||||
maintainers = ['eschnett']
|
||||
|
||||
version('2.1', sha256='3274f1061d1fac170130b8c75378a6b94580629b3dc1d53db244b51500ee4695')
|
||||
# Version 2.0 is disabled since it does not support cmake
|
||||
# version('2.0', sha256='b239e98316f93257161b25c8232634884edcee358982a74742981cc9b68da642')
|
||||
version('1.0', sha256='523dae83f1d93eab30114321f1c9a67e2006a52595da4c51f121ca139abe0857')
|
||||
|
||||
variant('simd',
|
||||
@ -21,17 +24,40 @@ class Nsimd(CMakePackage):
|
||||
'none',
|
||||
'CPU',
|
||||
'SSE2', 'SSE42', 'AVX', 'AVX2', 'AVX512_KNL', 'AVX512_SKYLAKE',
|
||||
'NEON128', 'AARCH64', 'SVE',
|
||||
'NEON128', 'AARCH64',
|
||||
'SVE', 'SVE128', 'SVE256', 'SVE512', 'SVE1024', 'SVE2048',
|
||||
'CUDA', 'ROCM',
|
||||
),
|
||||
multi=False)
|
||||
variant('optionals', values=any_combination_of('FMA', 'FP16'),
|
||||
description='Optional SIMD features',)
|
||||
|
||||
conflicts('simd=none', msg="SIMD instruction set not defined")
|
||||
conflicts('simd=SVE128', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=SVE256', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=SVE512', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=SVE1024', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=SVE2048', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=CUDA', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('simd=ROCM', when=('@:1'),
|
||||
msg="SIMD extension not available in version @:1")
|
||||
conflicts('optionals=FMA', when=('@2:'),
|
||||
msg="SIMD optionals not available in version @2:")
|
||||
conflicts('optionals=FP16', when=('@2:'),
|
||||
msg="SIMD optionals not available in version @2:")
|
||||
conflicts('optionals=FMA,FP16', when=('@2:'),
|
||||
msg="SIMD optionals not available in version @2:")
|
||||
|
||||
# Requires a C++14 compiler for building.
|
||||
# The C++ interface requires a C++11 compiler to use.
|
||||
depends_on('cmake@2.8.7:', type='build')
|
||||
depends_on('cmake@3.0.2:', type='build', when='@2:')
|
||||
depends_on('python@3:', type='build')
|
||||
|
||||
# Add a 'generate_code' phase in the beginning
|
||||
@ -39,24 +65,28 @@ class Nsimd(CMakePackage):
|
||||
|
||||
def generate_code(self, spec, prefix):
|
||||
"""Auto-generates code in the build directory"""
|
||||
options = [
|
||||
'egg/hatch.py',
|
||||
'--all',
|
||||
'--force',
|
||||
'--disable-clang-format',
|
||||
]
|
||||
python = spec['python'].command
|
||||
python(*options)
|
||||
if self.spec.satisfies("@:1"):
|
||||
options = [
|
||||
'egg/hatch.py',
|
||||
'--all',
|
||||
'--force',
|
||||
]
|
||||
python = spec['python'].command
|
||||
python(*options)
|
||||
|
||||
def cmake_args(self):
|
||||
# Required SIMD argument
|
||||
simd = self.spec.variants['simd'].value
|
||||
cmake_args = ["-DSIMD={0}".format(simd)]
|
||||
if self.spec.satisfies("@:1"):
|
||||
cmake_args = ["-DSIMD={0}".format(simd)]
|
||||
else:
|
||||
cmake_args = ["-Dsimd={0}".format(simd)]
|
||||
|
||||
# Optional SIMD instructions to be turned on explicitly
|
||||
optionals_value = self.spec.variants['optionals'].value
|
||||
if optionals_value != 'none':
|
||||
optionals_arg = ';'.join(optionals_value)
|
||||
cmake_args.append("-DSIMD_OPTIONALS={0}".format(optionals_arg))
|
||||
if self.spec.satisfies("@:1"):
|
||||
# Optional SIMD instructions to be turned on explicitly
|
||||
optionals_value = self.spec.variants['optionals'].value
|
||||
if optionals_value != 'none':
|
||||
optionals_arg = ';'.join(optionals_value)
|
||||
cmake_args.append("-DSIMD_OPTIONALS={0}".format(optionals_arg))
|
||||
|
||||
return cmake_args
|
||||
|
Loading…
Reference in New Issue
Block a user