|
| 1 | +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | + |
| 7 | +from spack.package import * |
| 8 | +from spack.pkg.builtin.boost import Boost |
| 9 | + |
| 10 | + |
| 11 | +class Rpp(CMakePackage): |
| 12 | + """Radeon Performance Primitives (RPP) library is a comprehensive high- |
| 13 | + performance computer vision library for AMD (CPU and GPU) with HIP |
| 14 | + and OPENCL back-ends""" |
| 15 | + |
| 16 | + homepage = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp" |
| 17 | + git = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp.git" |
| 18 | + url = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp/archive/0.97.tar.gz" |
| 19 | + |
| 20 | + maintainers = ["srekolam", "afzpatel"] |
| 21 | + tags = ["rocm"] |
| 22 | + |
| 23 | + version("1.1.0", sha256="9b1b9e721df27ee577819710b261071c68b2dccba96d9daf5d0535ee5f0e045f") |
| 24 | + version("1.0.0", sha256="040601e356b0a06c4ffb2043320ae822ab0da78af867392002c7b68dbd85989c") |
| 25 | + version("0.99", sha256="f1d7ec65d0148ddb7b3ce836a7e058727036df940d72d1683dee590a913fd44a") |
| 26 | + version("0.98", sha256="191b5d89bf990ae22b5ef73675b89ed4371c3ce342ab9cc65383fa12ef13086e") |
| 27 | + version("0.97", sha256="8ce1a869ff67a29579d87d399d8b0bd97bf12ae1b6b1ca1f161cb8a262fb9939") |
| 28 | + variant( |
| 29 | + "build_type", |
| 30 | + default="Release", |
| 31 | + values=("Release", "Debug", "RelWithDebInfo"), |
| 32 | + description="CMake build type", |
| 33 | + ) |
| 34 | + # Adding 3 variants OPENCL ,HIP , CPU with HIP as default. |
| 35 | + |
| 36 | + variant("opencl", default=False, description="Use OPENCL as the backend") |
| 37 | + variant("hip", default=True, description="Use HIP as backend") |
| 38 | + variant("cpu", default=False, description="Use CPU as backend") |
| 39 | + |
| 40 | + patch("0001-include-half-openmp-through-spack-package.patch") |
| 41 | + patch("0002-declare-handle-in-header.patch") |
| 42 | + |
| 43 | + def patch(self): |
| 44 | + if self.spec.satisfies("+hip"): |
| 45 | + filter_file( |
| 46 | + "${ROCM_PATH}/llvm", self.spec["llvm-amdgpu"].prefix, "CMakeLists.txt", string=True |
| 47 | + ) |
| 48 | + if self.spec.satisfies("+opencl"): |
| 49 | + filter_file( |
| 50 | + "${ROCM_PATH}", |
| 51 | + self.spec["rocm-opencl"].prefix, |
| 52 | + "cmake/FindOpenCL.cmake", |
| 53 | + string=True, |
| 54 | + ) |
| 55 | + |
| 56 | + depends_on( "[email protected]:", type="build") |
| 57 | + depends_on("pkgconfig", type="build") |
| 58 | + depends_on(Boost.with_default_variants) |
| 59 | + depends_on( "[email protected]:1.80.0") |
| 60 | + depends_on("bzip2") |
| 61 | + depends_on("half") |
| 62 | + depends_on("hwloc") |
| 63 | + depends_on( |
| 64 | + |
| 65 | + "+calib3d+features2d+highgui+imgcodecs+imgproc" |
| 66 | + "+video+videoio+flann+photo+objdetect", |
| 67 | + type="build", |
| 68 | + when="@1.0:", |
| 69 | + ) |
| 70 | + depends_on("libjpeg-turbo", type="build") |
| 71 | + depends_on("rocm-openmp-extras") |
| 72 | + conflicts("+opencl+hip") |
| 73 | + |
| 74 | + with when("+hip"): |
| 75 | + depends_on("hip@5:") |
| 76 | + with when("~hip"): |
| 77 | + depends_on("rocm-opencl@5:") |
| 78 | + |
| 79 | + def cmake_args(self): |
| 80 | + spec = self.spec |
| 81 | + args = [] |
| 82 | + args.append(self.define("ROCM_OPENMP_EXTRAS_DIR", spec["rocm-openmp-extras"].prefix)) |
| 83 | + if self.spec.satisfies("+opencl"): |
| 84 | + args.append(self.define("BACKEND", "OPENCL")) |
| 85 | + if self.spec.satisfies("+cpu"): |
| 86 | + args.append(self.define("BACKEND", "CPU")) |
| 87 | + if self.spec.satisfies("+hip"): |
| 88 | + args.append(self.define("BACKEND", "HIP")) |
| 89 | + args.append(self.define("HIP_PATH", spec["hip"].prefix)) |
| 90 | + args.append( |
| 91 | + self.define( |
| 92 | + "COMPILER_FOR_HIP", "{0}/bin/clang++".format(spec["llvm-amdgpu"].prefix) |
| 93 | + ) |
| 94 | + ) |
| 95 | + return args |
0 commit comments