Skip to content

Commit 05c247e

Browse files
Terry CojeanMathieu Taillefumier
authored andcommitted
Ginkgo: 1.7.0, change compatibility, update option oneapi->sycl (spack#40874)
Signed-off-by: Terry Cojean <terry.cojean@kit.edu>
1 parent edf7979 commit 05c247e

1 file changed

Lines changed: 44 additions & 20 deletions

File tree

var/spack/repos/builtin/packages/ginkgo/package.py

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage):
2424

2525
version("develop", branch="develop")
2626
version("master", branch="master")
27-
version("1.6.0", commit="1f1ed46e724334626f016f105213c047e16bc1ae", preferred=True) # v1.6.0
27+
version("1.7.0", commit="49242ff89af1e695d7794f6d50ed9933024b66fe") # v1.7.0
28+
version("1.6.0", commit="1f1ed46e724334626f016f105213c047e16bc1ae") # v1.6.0
2829
version("1.5.0", commit="234594c92b58e2384dfb43c2d08e7f43e2b58e7a") # v1.5.0
2930
version("1.5.0.glu_experimental", branch="glu_experimental")
3031
version("1.4.0", commit="f811917c1def4d0fcd8db3fe5c948ce13409e28e") # v1.4.0
@@ -37,13 +38,18 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage):
3738
variant("shared", default=True, description="Build shared libraries")
3839
variant("full_optimizations", default=False, description="Compile with all optimizations")
3940
variant("openmp", default=sys.platform != "darwin", description="Build with OpenMP")
40-
variant("oneapi", default=False, description="Build with oneAPI support")
41+
variant("sycl", default=False, description="Enable SYCL backend")
4142
variant("develtools", default=False, description="Compile with develtools enabled")
4243
variant("hwloc", default=False, description="Enable HWLOC support")
4344
variant("mpi", default=False, description="Enable MPI support")
4445

45-
depends_on("cmake@3.9:", type="build")
46-
depends_on("cuda@9:", when="+cuda")
46+
depends_on("cmake@3.9:", type="build", when="@:1.3.0")
47+
depends_on("cmake@3.13:", type="build", when="@1.4.0:1.6.0")
48+
depends_on("cmake@3.16:", type="build", when="@1.7.0:")
49+
depends_on("cmake@3.18:", type="build", when="+cuda@1.7.0:")
50+
depends_on("cuda@9:", when="+cuda @:1.4.0")
51+
depends_on("cuda@9.2:", when="+cuda @1.5.0:")
52+
depends_on("cuda@10.1:", when="+cuda @1.7.0:")
4753
depends_on("mpi", when="+mpi")
4854

4955
depends_on("rocthrust", when="+rocm")
@@ -60,14 +66,13 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage):
6066
depends_on("googletest", type="test")
6167
depends_on("numactl", type="test", when="+hwloc")
6268

63-
depends_on("intel-oneapi-mkl", when="+oneapi")
64-
depends_on("intel-oneapi-dpl", when="+oneapi")
69+
depends_on("intel-oneapi-mkl", when="+sycl")
70+
depends_on("intel-oneapi-dpl", when="+sycl")
71+
depends_on("intel-oneapi-tbb", when="+sycl")
6572

6673
conflicts("%gcc@:5.2.9")
6774
conflicts("+rocm", when="@:1.1.1")
6875
conflicts("+mpi", when="@:1.4.0")
69-
conflicts("+cuda", when="+rocm")
70-
conflicts("+openmp", when="+oneapi")
7176

7277
# ROCm 4.1.0 breaks platform settings which breaks Ginkgo's HIP support.
7378
conflicts("^hip@4.1.0:", when="@:1.3.0")
@@ -76,22 +81,35 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage):
7681
conflicts("^rocthrust@4.1.0:", when="@:1.3.0")
7782
conflicts("^rocprim@4.1.0:", when="@:1.3.0")
7883

84+
# Ginkgo 1.6.0 start relying on ROCm 4.5.0
85+
conflicts("^hip@:4.3.1", when="@1.6.0:")
86+
conflicts("^hipblas@:4.3.1", when="@1.6.0:")
87+
conflicts("^hipsparse@:4.3.1", when="@1.6.0:")
88+
conflicts("^rocthrust@:4.3.1", when="@1.6.0:")
89+
conflicts("^rocprim@:4.3.1", when="@1.6.0:")
90+
91+
conflicts(
92+
"+sycl", when="@:1.4.0", msg="For SYCL support, please use Ginkgo version 1.4.0 and newer."
93+
)
94+
7995
# Skip smoke tests if compatible hardware isn't found
8096
patch("1.4.0_skip_invalid_smoke_tests.patch", when="@1.4.0")
8197

82-
# Newer DPC++ compilers use the updated SYCL 2020 standard which change
83-
# kernel attribute propagation rules. This doesn't work well with the
84-
# initial Ginkgo oneAPI support.
85-
patch("1.4.0_dpcpp_use_old_standard.patch", when="+oneapi @1.4.0")
86-
8798
# Add missing include statement
8899
patch("thrust-count-header.patch", when="+rocm @1.5.0")
89100

90101
def setup_build_environment(self, env):
91102
spec = self.spec
92-
if "+oneapi" in spec:
103+
if "+sycl" in spec:
93104
env.set("MKLROOT", join_path(spec["intel-oneapi-mkl"].prefix, "mkl", "latest"))
94105
env.set("DPL_ROOT", join_path(spec["intel-oneapi-dpl"].prefix, "dpl", "latest"))
106+
# The `IntelSYCLConfig.cmake` is broken with spack. By default, it
107+
# relies on the CMAKE_CXX_COMPILER being the real ipcx/dpcpp
108+
# compiler. If not, the variable SYCL_COMPILER of that script is
109+
# broken, and all the SYCL detection mechanism is wrong. We fix it
110+
# by giving hint environment variables.
111+
env.set("SYCL_LIBRARY_DIR_HINT", os.path.dirname(os.path.dirname(self.compiler.cxx)))
112+
env.set("SYCL_INCLUDE_DIR_HINT", os.path.dirname(os.path.dirname(self.compiler.cxx)))
95113

96114
def cmake_args(self):
97115
# Check that the have the correct C++ standard is available
@@ -106,18 +124,19 @@ def cmake_args(self):
106124
except UnsupportedCompilerFlag:
107125
raise InstallError("Ginkgo requires a C++14-compliant C++ compiler")
108126

109-
cxx_is_dpcpp = os.path.basename(self.compiler.cxx) == "dpcpp"
110-
if self.spec.satisfies("+oneapi") and not cxx_is_dpcpp:
111-
raise InstallError(
112-
"Ginkgo's oneAPI backend requires the" + "DPC++ compiler as main CXX compiler."
113-
)
127+
if self.spec.satisfies("@1.4.0:1.6.0 +sycl") and not self.spec.satisfies(
128+
"%oneapi@2021.3.0:"
129+
):
130+
raise InstallError("ginkgo +sycl requires %oneapi@2021.3.0:")
131+
elif self.spec.satisfies("@1.7.0: +sycl") and not self.spec.satisfies("%oneapi@2022.1.0:"):
132+
raise InstallError("ginkgo +sycl requires %oneapi@2022.1.0:")
114133

115134
spec = self.spec
116135
from_variant = self.define_from_variant
117136
args = [
118137
from_variant("GINKGO_BUILD_CUDA", "cuda"),
119138
from_variant("GINKGO_BUILD_HIP", "rocm"),
120-
from_variant("GINKGO_BUILD_DPCPP", "oneapi"),
139+
from_variant("GINKGO_BUILD_SYCL", "sycl"),
121140
from_variant("GINKGO_BUILD_OMP", "openmp"),
122141
from_variant("GINKGO_BUILD_MPI", "mpi"),
123142
from_variant("BUILD_SHARED_LIBS", "shared"),
@@ -161,6 +180,11 @@ def cmake_args(self):
161180
args.append(
162181
self.define("CMAKE_MODULE_PATH", self.spec["hip"].prefix.lib.cmake.hip)
163182
)
183+
184+
if "+sycl" in self.spec:
185+
sycl_compatible_compilers = ["dpcpp", "icpx"]
186+
if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers):
187+
raise InstallError("ginkgo +sycl requires DPC++ (dpcpp) or icpx compiler.")
164188
return args
165189

166190
@property

0 commit comments

Comments
 (0)