easi: update package, rework impalajit (#34032)

This commit is contained in:
Thomas-Ulrich 2022-11-28 15:54:21 +01:00 committed by GitHub
parent 1374577659
commit 35e5a916bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 64 deletions

View File

@ -3,12 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import shutil
from spack.package import * from spack.package import *
from spack.repo import GitExe
class Easi(CMakePackage): class Easi(CMakePackage):
@ -19,60 +14,49 @@ class Easi(CMakePackage):
homepage = "https://easyinit.readthedocs.io" homepage = "https://easyinit.readthedocs.io"
git = "https://github.com/SeisSol/easi.git" git = "https://github.com/SeisSol/easi.git"
maintainers = ["ThrudPrimrose", "ravil-mobile", "krenzland"] maintainers = ["ravil-mobile", "Thomas-Ulrich", "krenzland", "ThrudPrimrose"]
version("develop", branch="master") version("develop", branch="master")
version("1.2.0", tag="v1.2.0")
version("1.1.2", tag="v1.1.2") version("1.1.2", tag="v1.1.2")
variant("asagi", default=True, description="build with ASAGI support") variant("asagi", default=True, description="build with ASAGI support")
variant( variant(
"jit", "jit",
default="impalajit", default="impalajit,lua",
description="build with JIT support", description="build with JIT support",
values=("impalajit", "impalajit-llvm", "lua"), values=("impalajit", "impalajit-llvm", "lua"),
multi=False, multi=True,
) )
depends_on("asagi +mpi +mpi3", when="+asagi") depends_on("asagi +mpi +mpi3", when="+asagi")
depends_on("yaml-cpp@0.6.2") depends_on("yaml-cpp@0.6.2")
depends_on("impalajit-llvm@1.0.0", when="jit=impalajit-llvm")
depends_on("impalajit@llvm-1.0.0", when="jit=impalajit-llvm")
depends_on("lua@5.3.2", when="jit=lua") depends_on("lua@5.3.2", when="jit=lua")
depends_on("git", type="build", when="jit=impalajit") depends_on("impalajit", when="jit=impalajit")
conflicts("jit=impalajit", when="jit=impalajit-llvm")
conflicts("jit=impalajit-llvm", when="jit=impalajit")
conflicts("jit=impalajit", when="target=aarch64:") conflicts("jit=impalajit", when="target=aarch64:")
conflicts("jit=impalajit", when="target=ppc64:") conflicts("jit=impalajit", when="target=ppc64:")
conflicts("jit=impalajit", when="target=ppc64le:") conflicts("jit=impalajit", when="target=ppc64le:")
conflicts("jit=impalajit", when="target=riscv64:") conflicts("jit=impalajit", when="target=riscv64:")
def pre_build(self):
spec = self.spec
if "jit=impalajit" in spec:
impalajir_src = join_path(self.stage.source_path, "impalajit")
if os.path.isdir(impalajir_src):
shutil.rmtree(impalajir_src)
git_exe = GitExe()
git_exe("clone", "https://github.com/uphoffc/ImpalaJIT.git", impalajir_src)
with working_dir(join_path(impalajir_src, "build"), create=True):
cmake("..", "-DCMAKE_INSTALL_PREFIX={0}".format(self.spec.prefix))
make()
make("install")
def cmake_args(self): def cmake_args(self):
self.pre_build()
args = [] args = []
args.append(self.define_from_variant("ASAGI", "asagi")) args.append(self.define_from_variant("ASAGI", "asagi"))
spec = self.spec
with_impala = "jit=impalajit" in self.spec if "jit=impalajit" in spec or "jit=impalajit-llvm" in spec:
with_impala |= "jit=impalajit-llvm" in self.spec
if with_impala:
args.append(self.define("IMPALAJIT", True)) args.append(self.define("IMPALAJIT", True))
backend_type = "llvm" if "jit=impalajit-llvm" in self.spec else "original" backend_type = "llvm" if "jit=impalajit-llvm" in spec else "original"
args.append(self.define("IMPALAJIT_BACKEND", backend_type)) args.append(self.define("IMPALAJIT_BACKEND", backend_type))
else:
if "jit=lua" in self.spec:
args.append(self.define("IMPALAJIT", False)) args.append(self.define("IMPALAJIT", False))
if "jit=lua" in spec:
args.append(self.define("LUA", True)) args.append(self.define("LUA", True))
return args return args

View File

@ -1,32 +0,0 @@
# Copyright 2013-2021 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)
from spack.package import *
class ImpalajitLlvm(CMakePackage):
"""Impala is a calculator-like language. This is a fork of
the original ImpalaJIT project and was enhanced with LLVM JIT.
Impala acts as a backend for `easi` project.
"""
homepage = "https://github.com/ravil-mobile/ImpalaJIT"
git = "https://github.com/ravil-mobile/ImpalaJIT"
maintainers = ["ravil-mobile"]
version("develop", branch="master")
version("1.0.0", tag="v1.0.0")
variant("shared", default=True, description="build as a shared library")
depends_on("llvm@10.0.0:11.1.0")
depends_on("z3")
def cmake_args(self):
args = []
args.append(self.define_from_variant("SHARED_LIB", "shared"))
return args

View File

@ -0,0 +1,46 @@
# 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)
from spack.package import *
class Impalajit(CMakePackage):
"""A lightweight JIT compiler for flexible data access in simulation applications.
impalajit@llvm is enhanced with LLVM JIT. This means that impalajit@llvm is
supposed to work on any architecture supported by llvm, contrary to the
impalajit@main package which is restricted to x86 architectures.This comes at the
price of extra dependencies. Impala acts as a backend for `easi` project."""
homepage = "https://github.com/manuel-fasching/ImpalaJIT/blob/master/README.md"
version(
"main",
git="https://github.com/manuel-fasching/ImpalaJIT.git",
branch="master",
preferred=True,
)
version("llvm", git="https://github.com/ravil-mobile/ImpalaJIT.git", branch="dev")
version("llvm-1.0.0", git="https://github.com/ravil-mobile/ImpalaJIT.git", tag="v1.0.0")
maintainers = ["ravil-mobile", "Thomas-Ulrich"]
variant("shared", default=True, description="build as a shared library")
depends_on("cmake", type="build")
depends_on("pkg-config", type="build", when="@main")
depends_on("llvm@10.0.0:11.1.0", when="@llvm")
depends_on("z3", when="@llvm")
depends_on("llvm@10.0.0:11.1.0", when="@llvm-1.0.0")
depends_on("z3", when="@llvm-1.0.0")
def cmake_args(self):
args = []
args.append(self.define_from_variant("SHARED_LIB", "shared"))
args.append(self.define("TESTS", self.run_tests))
if self.compiler != "intel":
args.append("-DINTEL_COMPILER=OFF")
return args