summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToyohisa Kameyama <kameyama@riken.jp>2019-08-03 09:10:39 +0900
committerAdam J. Stewart <ajstewart426@gmail.com>2019-08-02 19:10:39 -0500
commitdbeee34829a7e04544464fed671cf29b2e11ae6c (patch)
tree792eb9582c624e487759c0efe5010524126ce34d
parentff15f614430c07d84db13f68ed861a8211703f85 (diff)
downloadspack-dbeee34829a7e04544464fed671cf29b2e11ae6c.tar.gz
spack-dbeee34829a7e04544464fed671cf29b2e11ae6c.tar.bz2
spack-dbeee34829a7e04544464fed671cf29b2e11ae6c.tar.xz
spack-dbeee34829a7e04544464fed671cf29b2e11ae6c.zip
vdt: add simd variant (#12188)
1. add simd variant and check target. 2. build on source directory before 0.3.8.
-rw-r--r--var/spack/repos/builtin/packages/vdt/package.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/vdt/package.py b/var/spack/repos/builtin/packages/vdt/package.py
index eebaa2b244..8924b825f6 100644
--- a/var/spack/repos/builtin/packages/vdt/package.py
+++ b/var/spack/repos/builtin/packages/vdt/package.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
+from spack.spec import ConflictsInSpecError
class Vdt(CMakePackage):
@@ -18,3 +19,64 @@ class Vdt(CMakePackage):
version('0.3.8', '25b07c72510aaa95fffc11e33579061c')
version('0.3.7', 'd2621d4c489894fd1fe8e056d9a0a67c')
version('0.3.6', '6eaff3bbbd5175332ccbd66cd71a741d')
+
+ simd_x86 = ('sse', 'avx', 'avx2', 'fma')
+ simd_all = ('sse', 'avx', 'avx2', 'fma', 'neon')
+ variant(
+ 'simd',
+ default='None',
+ values=simd_all,
+ description='USE simd instruction set',
+ multi=True
+ )
+
+ def flag_handler(self, name, flags):
+ arch = ''
+ spec = self.spec
+ if (spec.satisfies("platform=cray")):
+ # FIXME; It is assumed that cray is x86_64.
+ # If you support arm on cray, you need to fix it.
+ arch = 'x86_64'
+ if (arch != 'x86_64' and not spec.satisfies("target=x86_64")):
+ for s in self.simd_x86:
+ if (spec.satisfies("simd={0}".format(s))):
+ raise ConflictsInSpecError(
+ spec,
+ [(
+ spec,
+ spec.architecture.target,
+ spec.variants['simd'],
+ 'simd=sse,avx,avx2 and fma are valid'
+ ' only on x86_64'
+ )]
+ )
+ # FIXME: It is assumed that arm 32 bit target is arm.
+ if (arch != 'arm' and not spec.satisfies("target=arm")):
+ if (spec.satisfies("simd=neon")):
+ raise ConflictsInSpecError(
+ spec,
+ [(
+ spec,
+ spec.architecture.target,
+ spec.variants['simd'],
+ 'simd=neon is valid only on arm 32 bit'
+ )]
+ )
+ return (flags, None, None)
+
+ @property
+ def build_directory(self):
+ d = join_path(self.stage.path, 'spack-build')
+ if self.spec.satisfies('@:0.3.8'):
+ d = self.stage.source_path
+ return d
+
+ def cmake_args(self):
+ options = []
+
+ for s in self.simd_all:
+ options.append(
+ "-D{0}=".format(s.upper()) +
+ ("ON" if (s in self.spec.variants['simd'].value) else "OFF")
+ )
+ return options