summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorafzpatel <122491982+afzpatel@users.noreply.github.com>2024-01-17 17:42:55 -0500
committerGitHub <noreply@github.com>2024-01-17 15:42:55 -0700
commit277e1ff39619bdec72db88b1788661a4119e4bb6 (patch)
tree49b4db5f880da00378598086291be8c609aa1e2e
parenteda4d3fa06f0d6c1aec383fe0bc6dddf81b3395d (diff)
downloadspack-277e1ff39619bdec72db88b1788661a4119e4bb6.tar.gz
spack-277e1ff39619bdec72db88b1788661a4119e4bb6.tar.bz2
spack-277e1ff39619bdec72db88b1788661a4119e4bb6.tar.xz
spack-277e1ff39619bdec72db88b1788661a4119e4bb6.zip
rpp: add a variant to install tests, update mivisionx dependency (#41774)
-rw-r--r--var/spack/repos/builtin/packages/mivisionx/package.py2
-rw-r--r--var/spack/repos/builtin/packages/rpp/0003-changes-to-rpp-unit-tests.patch62
-rw-r--r--var/spack/repos/builtin/packages/rpp/package.py48
3 files changed, 109 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/mivisionx/package.py b/var/spack/repos/builtin/packages/mivisionx/package.py
index cd77fdca6b..153469f16e 100644
--- a/var/spack/repos/builtin/packages/mivisionx/package.py
+++ b/var/spack/repos/builtin/packages/mivisionx/package.py
@@ -289,7 +289,7 @@ class Mivisionx(CMakePackage):
depends_on(
"opencv@4.5:"
"+calib3d+features2d+highgui+imgcodecs+imgproc"
- "+video+videoio+flann+photo+objdetect",
+ "+video+videoio+flann+photo+objdetect+png+jpeg",
type="build",
when="@5.3:",
)
diff --git a/var/spack/repos/builtin/packages/rpp/0003-changes-to-rpp-unit-tests.patch b/var/spack/repos/builtin/packages/rpp/0003-changes-to-rpp-unit-tests.patch
new file mode 100644
index 0000000000..b38e526563
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rpp/0003-changes-to-rpp-unit-tests.patch
@@ -0,0 +1,62 @@
+From: Afzal Patel <afzal.patel@amd.com>
+Date: Tue Jan 9 09:57:48 PST 2024
+Subject: [PATCH] changes-to-rpp-unit-tests
+Description: This patch makes changes to the CMakeLists.txt for the rpp unit tests.
+ It adds the directory which contains half.hpp and also modifies the method
+ the libjpegturbo library is linked.
+---
+diff git a/utilities/test_suite/HIP/CMakeLists.txt b/utilities/test_suite/HIP/CMakeLists.txt
+index 8f32a66..456999e 100644
+--- a/utilities/test_suite/HIP/CMakeLists.txt
++++ b/utilities/test_suite/HIP/CMakeLists.txt
+@@ -55,7 +55,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+ if(TurboJpeg_FOUND)
+ message("-- ${Green}${PROJECT_NAME} set to build with rpp and TurboJpeg${ColourReset}")
+ include_directories(${TurboJpeg_INCLUDE_DIRS})
+- set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${TurboJpeg_LIBRARIES_DIR})
++ set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${TurboJpeg_LIBRARIES})
+ else()
+ message("-- ${Yellow}Error: TurboJpeg must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
+ endif()
+@@ -72,7 +72,7 @@ if (hip_FOUND AND OpenCV_FOUND)
+
+ add_executable(Tensor_hip Tensor_hip.cpp)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGPU_SUPPORT=1 -DRPP_BACKEND_HIP=1 -std=gnu++14")
+- target_link_libraries(Tensor_hip ${OpenCV_LIBS} -lturbojpeg -lrpp ${hip_LIBRARIES} pthread ${LINK_LIBRARY_LIST} hip::device)
++ target_link_libraries(Tensor_hip ${OpenCV_LIBS} -lrpp ${hip_LIBRARIES} pthread ${LINK_LIBRARY_LIST} hip::device)
+ else()
+ message("-- ${Yellow}Error: OpenCV and hip must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
+-endif()
+\ No newline at end of file
++endif()
+diff --git a/utilities/test_suite/HOST/CMakeLists.txt b/utilities/test_suite/HOST/CMakeLists.txt
+index bad0d60..5a8fd5c 100644
+--- a/utilities/test_suite/HOST/CMakeLists.txt
++++ b/utilities/test_suite/HOST/CMakeLists.txt
+@@ -50,10 +50,13 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -ggdb -O0")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+ set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} OpenMP::OpenMP_CXX)
+
++find_path(HALF_INCLUDE_DIR half.hpp)
++include_directories(${HALF_INCLUDE_DIR})
++
+ if(TurboJpeg_FOUND)
+ message("-- ${Green}${PROJECT_NAME} set to build with rpp and TurboJpeg${ColourReset}")
+ include_directories(${TurboJpeg_INCLUDE_DIRS})
+- set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${TurboJpeg_LIBRARIES_DIR})
++ set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${TurboJpeg_LIBRARIES})
+ else()
+ message("-- ${Yellow}Error: TurboJpeg must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
+ endif()
+@@ -67,8 +70,8 @@ if (OpenCV_FOUND)
+ add_executable(Tensor_host Tensor_host.cpp)
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
+- target_link_libraries(Tensor_host ${OpenCV_LIBS} -lturbojpeg -lrpp pthread ${LINK_LIBRARY_LIST})
++ target_link_libraries(Tensor_host ${OpenCV_LIBS} -lrpp pthread ${LINK_LIBRARY_LIST})
+
+ else()
+ message("-- ${Yellow}Error: OpenCV must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
+-endif()
+\ No newline at end of file
++endif()
diff --git a/var/spack/repos/builtin/packages/rpp/package.py b/var/spack/repos/builtin/packages/rpp/package.py
index a88093a060..116fa90328 100644
--- a/var/spack/repos/builtin/packages/rpp/package.py
+++ b/var/spack/repos/builtin/packages/rpp/package.py
@@ -48,10 +48,19 @@ class Rpp(CMakePackage):
variant("opencl", default=False, description="Use OPENCL as the backend")
variant("hip", default=True, description="Use HIP as backend")
variant("cpu", default=False, description="Use CPU as backend")
+ variant(
+ "add_tests",
+ default=False,
+ description="add utilities folder which contains rpp unit tests",
+ )
patch("0001-include-half-openmp-through-spack-package.patch")
patch("0002-declare-handle-in-header.patch")
+ # adds half.hpp include directory and modifies how the libjpegturbo
+ # library is linked for the rpp unit test
+ patch("0003-changes-to-rpp-unit-tests.patch", when="+add_tests")
+
def patch(self):
if self.spec.satisfies("+hip"):
filter_file(
@@ -64,6 +73,31 @@ class Rpp(CMakePackage):
"cmake/FindOpenCL.cmake",
string=True,
)
+ if self.spec.satisfies("+add_tests"):
+ filter_file(
+ "${ROCM_PATH}/include/rpp",
+ self.spec.prefix.include.rpp,
+ "utilities/test_suite/HOST/CMakeLists.txt",
+ string=True,
+ )
+ filter_file(
+ "${ROCM_PATH}/lib",
+ self.spec.prefix.lib,
+ "utilities/test_suite/HOST/CMakeLists.txt",
+ string=True,
+ )
+ filter_file(
+ "${ROCM_PATH}/include/rpp",
+ self.spec.prefix.include.rpp,
+ "utilities/test_suite/HIP/CMakeLists.txt",
+ string=True,
+ )
+ filter_file(
+ "${ROCM_PATH}/lib",
+ self.spec.prefix.lib,
+ "utilities/test_suite/HIP/CMakeLists.txt",
+ string=True,
+ )
depends_on("cmake@3.5:", type="build")
depends_on("pkgconfig", type="build")
@@ -76,10 +110,10 @@ class Rpp(CMakePackage):
"opencv@4.5:"
"+calib3d+features2d+highgui+imgcodecs+imgproc"
"+video+videoio+flann+photo+objdetect",
- type="build",
+ type=("build", "link"),
when="@1.0:",
)
- depends_on("libjpeg-turbo", type="build")
+ depends_on("libjpeg-turbo", type=("build", "link"))
depends_on("rocm-openmp-extras")
conflicts("+opencl+hip")
@@ -88,6 +122,10 @@ class Rpp(CMakePackage):
with when("~hip"):
depends_on("rocm-opencl@5:")
+ def setup_run_environment(self, env):
+ if self.spec.satisfies("+add_tests"):
+ env.set("TURBO_JPEG_PATH", self.spec["libjpeg-turbo"].prefix)
+
def cmake_args(self):
spec = self.spec
args = []
@@ -105,3 +143,9 @@ class Rpp(CMakePackage):
)
)
return args
+
+ @run_after("install")
+ def add_tests(self):
+ if self.spec.satisfies("+add_tests"):
+ install_tree("utilities", self.spec.prefix.utilities)
+ install_tree("cmake", self.spec.prefix.cmake)