From b2d3e01fe60bdcbac03e657da58bb41f3a6c5624 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Thu, 19 Oct 2023 09:31:02 -0500 Subject: petsc: add variant +sycl (#40562) * petsc: add variant +sycl * petsc: add in gmake as dependency - so that consistent make gets used between petsc and slepc builds [that can have different env for each of the builds] --- var/spack/repos/builtin/packages/petsc/package.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 9d0d3a9016..2f258edc17 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -87,6 +87,7 @@ class Petsc(Package, CudaPackage, ROCmPackage): variant("double", default=True, description="Switches between single and double precision") variant("complex", default=False, description="Build with complex numbers") variant("debug", default=False, description="Compile in debug mode") + variant("sycl", default=False, description="Enable sycl build") variant("metis", default=True, description="Activates support for metis and parmetis") variant( @@ -207,6 +208,8 @@ class Petsc(Package, CudaPackage, ROCmPackage): patch("revert-3.18.0-ver-format-for-dealii.patch", when="@3.18.0") depends_on("diffutils", type="build") + # not listed as a "build" dependency - so that slepc build gets the same dependency + depends_on("gmake") # Virtual dependencies # Git repository needs sowing to build Fortran interface @@ -338,6 +341,9 @@ class Petsc(Package, CudaPackage, ROCmPackage): when="+kokkos +rocm amdgpu_target=%s" % rocm_arch, ) + conflicts("~kokkos", when="+sycl", msg="+sycl requires +kokkos") + depends_on("kokkos+sycl", when="+sycl +kokkos") + phases = ["configure", "build", "install"] # Using the following tarballs @@ -434,6 +440,16 @@ class Petsc(Package, CudaPackage, ROCmPackage): else: options.append("--with-x=0") + if "+sycl" in spec: + sycl_compatible_compilers = ["icpx"] + if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): + raise InstallError("PETSc's SYCL GPU Backend requires oneAPI CXX (icpx) compiler.") + options.append("--with-sycl=1") + options.append("--with-syclc=" + self.compiler.cxx) + options.append("SYCLPPFLAGS=-Wno-tautological-constant-compare") + else: + options.append("--with-sycl=0") + if "trilinos" in spec: if spec.satisfies("^trilinos+boost"): options.append("--with-boost=1") -- cgit v1.2.3-60-g2f50