rpp: add a variant to install tests, update mivisionx dependency (#41774)
This commit is contained in:
parent
eda4d3fa06
commit
277e1ff396
@ -289,7 +289,7 @@ def patch(self):
|
||||
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:",
|
||||
)
|
||||
|
@ -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()
|
@ -48,10 +48,19 @@ def url_for_version(self, version):
|
||||
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 @@ def patch(self):
|
||||
"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 @@ def patch(self):
|
||||
"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 @@ def patch(self):
|
||||
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 @@ def cmake_args(self):
|
||||
)
|
||||
)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user