Skip to content

Commit

Permalink
Package - Updates and bugfixes (#488)
Browse files Browse the repository at this point in the history
* Package - remove clang from test

* CMakeLists - remove BUILD_WITH_AMD_ADVANCE

* Package - Add OMP dependency

* Find Packages - Updates

* Test Package - Deps

* Test - backend Info

* Tests - Fix HIP Test Add

* Test - Add HIP Path

* Test - Find HIP Updates

* Tests - Fix HIP compilation
  • Loading branch information
kiritigowda authored Dec 14, 2024
1 parent 45a4268 commit b4210f1
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 59 deletions.
26 changes: 16 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(DEFAULT_BUILD_TYPE "Release")
### RPP_AUDIO_SUPPORT - default = ON, NOTE: support currently only on Ubuntu - user to set to OFF otherwise
option(RPP_AUDIO_SUPPORT "Build RPP with Audio Support" ON)
option(BUILD_WITH_AMD_ADVANCE "Build RPP for advanced AMD GPU Architecture" OFF)

# Set message options
if(NOT WIN32)
Expand Down Expand Up @@ -154,7 +153,6 @@ message("-- ${Cyan}RPP Developer Options${ColourReset}")
message("-- ${Cyan} -D BACKEND=${BACKEND} [Select RPP Backend [options:CPU/OPENCL/HIP](default:HIP)]${ColourReset}")
message("-- ${Cyan} -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} [Select RPP build type [options:Debug/Release](default:Release)]${ColourReset}")
message("-- ${Cyan} -D RPP_AUDIO_SUPPORT=${RPP_AUDIO_SUPPORT} [Select RPP audio support [options:ON/OFF](default:ON)]${ColourReset}")
message("-- ${Cyan} -D BUILD_WITH_AMD_ADVANCE=${BUILD_WITH_AMD_ADVANCE} [Turn ON/OFF Build for AMD advanced GPUs(default:OFF)]${ColourReset}")

# OpenMP
find_package(OpenMP REQUIRED)
Expand Down Expand Up @@ -227,10 +225,7 @@ if("${BACKEND}" STREQUAL "HIP")
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH} ${ROCM_PATH}/hip)

# Set supported GPU Targets
set(DEFAULT_GPU_TARGETS "gfx908;gfx90a;gfx942;gfx1030;gfx1031;gfx1032;gfx1100;gfx1101;gfx1102")
if (BUILD_WITH_AMD_ADVANCE)
set(DEFAULT_GPU_TARGETS ${DEFAULT_GPU_TARGETS} "gfx1200;gfx1201")
endif()
set(DEFAULT_GPU_TARGETS "gfx908;gfx90a;gfx942;gfx1030;gfx1031;gfx1032;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201")

# Set AMD GPU_TARGETS
if((AMDGPU_TARGETS OR DEFINED ENV{AMDGPU_TARGETS}) AND (NOT GPU_TARGETS))
Expand Down Expand Up @@ -425,8 +420,19 @@ endif()
# Set the dependent packages
set(RPP_DEBIAN_PACKAGE_LIST "rocm-hip-runtime")
set(RPP_RPM_PACKAGE_LIST "rocm-hip-runtime")
set(RPP_DEBIAN_DEV_PACKAGE_LIST "rocm-hip-runtime-dev, half")
set(RPP_RPM_DEV_PACKAGE_LIST "rocm-hip-runtime-devel, half")
set(RPP_DEBIAN_DEV_PACKAGE_LIST "rocm-hip-runtime-dev, half, libomp-dev")
set(RPP_RPM_DEV_PACKAGE_LIST "rocm-hip-runtime-devel, half, libomp-devel")
set(RPP_DEBIAN_TEST_PACKAGE_LIST "python3-dev, python3-pip, libopencv-dev")
set(RPP_RPM_TEST_PACKAGE_LIST "python3-devel, python3-pip") # TBD: OpenCV Package missing on RPM

# Add OS specific dependencies
if(EXISTS "/etc/os-release")
file(READ "/etc/os-release" OS_RELEASE)
string(REGEX MATCH "22.04" UBUNTU_22_FOUND ${OS_RELEASE})
if(UBUNTU_22_FOUND)
set(RPP_DEBIAN_DEV_PACKAGE_LIST "${RPP_DEBIAN_DEV_PACKAGE_LIST}, libstdc++-12-dev")
endif()
endif()

# package release
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
Expand Down Expand Up @@ -461,7 +467,7 @@ set(CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS "rocm-core, ${RPP_DEBIAN_PACKAGE_LIST}"
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${PROJECT_NAME}-dev")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "rocm-core, ${PROJECT_NAME}, ${RPP_DEBIAN_DEV_PACKAGE_LIST}")
set(CPACK_DEBIAN_TEST_PACKAGE_NAME "${PROJECT_NAME}-test")
set(CPACK_DEBIAN_TEST_PACKAGE_DEPENDS "rocm-core, ${PROJECT_NAME}-dev, clang")
set(CPACK_DEBIAN_TEST_PACKAGE_DEPENDS "rocm-core, ${PROJECT_NAME}-dev, ${RPP_DEBIAN_TEST_PACKAGE_LIST}")
set(CPACK_DEBIAN_PACKAGE_LICENSE "MIT" )
# Debian package specific variable for ASAN
set(CPACK_DEBIAN_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" )
Expand All @@ -473,7 +479,7 @@ set(CPACK_RPM_RUNTIME_PACKAGE_REQUIRES "rocm-core, ${RPP_RPM_PACKAGE_LIST}")
set(CPACK_RPM_DEV_PACKAGE_NAME "${PROJECT_NAME}-devel")
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}, ${RPP_RPM_DEV_PACKAGE_LIST}")
set(CPACK_RPM_TEST_PACKAGE_NAME "${PROJECT_NAME}-test")
set(CPACK_RPM_TEST_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}-devel, clang")
set(CPACK_RPM_TEST_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}-devel, ${RPP_RPM_TEST_PACKAGE_LIST}")
set(CPACK_RPM_PACKAGE_LICENSE "MIT" )
# RPM package specific variable for ASAN
set(CPACK_RPM_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" )
Expand Down
61 changes: 33 additions & 28 deletions cmake/FindTurboJpeg.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#[[
MIT License
Copyright (c) 2019 - 2024 Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]

################################################################################
#
# MIT License
#
# Copyright (c) 2017 - 2024 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
################################################################################
if(APPLE)
set(SHARED_LIB_TYPE ".dylib")
else()
Expand All @@ -48,6 +49,7 @@ find_library(TurboJpeg_LIBRARIES
${TURBO_JPEG_PATH}/lib
${TURBO_JPEG_PATH}/lib64
/usr/lib
#/usr/lib/x86_64-linux-gnu - package install libturbojpeg0-dev
/opt/libjpeg-turbo/lib
)
mark_as_advanced(TurboJpeg_LIBRARIES)
Expand All @@ -61,6 +63,7 @@ find_path(TurboJpeg_LIBRARIES_DIRS
${TURBO_JPEG_PATH}/lib
${TURBO_JPEG_PATH}/lib64
/usr/lib
#/usr/lib/x86_64-linux-gnu - package install libturbojpeg0-dev
/opt/libjpeg-turbo/lib
)
mark_as_advanced(TurboJpeg_LIBRARIES_DIRS)
Expand All @@ -70,10 +73,12 @@ if(TurboJpeg_LIBRARIES AND TurboJpeg_INCLUDE_DIRS)
endif( )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( TurboJpeg
FOUND_VAR TurboJpeg_FOUND
find_package_handle_standard_args(
TurboJpeg
FOUND_VAR
TurboJpeg_FOUND
REQUIRED_VARS
TurboJpeg_LIBRARIES
TurboJpeg_LIBRARIES
TurboJpeg_INCLUDE_DIRS
TurboJpeg_LIBRARIES_DIRS
)
Expand All @@ -90,4 +95,4 @@ else()
message(FATAL_ERROR "{Red}FindTurboJpeg -- NOT FOUND${ColourReset}")
endif()
message( "-- ${Yellow}NOTE: FindTurboJpeg failed to find -- turbojpeg${ColourReset}" )
endif()
endif()
4 changes: 2 additions & 2 deletions utilities/examples/brightness/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if(NOT WIN32)
set(White "${Esc}[37m")
endif()

find_package(hip QUIET)
find_package(HIP QUIET)
find_package(OpenCV QUIET)
find_package(TurboJpeg QUIET)

Expand All @@ -59,7 +59,7 @@ else()
message("-- ${Yellow}Error: TurboJpeg must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
endif()

if (hip_FOUND AND OpenCV_FOUND)
if (HIP_FOUND AND OpenCV_FOUND)
message("-- ${Green}${PROJECT_NAME} set to build with rpp, hip and OpenCV${ColourReset}")
set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/amdclang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
Expand Down
4 changes: 2 additions & 2 deletions utilities/rpp-performancetests/HIP_NEW/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ if(NOT WIN32)
set(White "${Esc}[37m")
endif()

find_package(hip QUIET)
find_package(HIP QUIET)
find_package(OpenCV QUIET)

# OpenMP
find_package(OpenMP REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

if (hip_FOUND AND OpenCV_FOUND)
if(HIP_FOUND AND OpenCV_FOUND)
message("-- ${Green}${PROJECT_NAME} set to build with rpp, hip and OpenCV${ColourReset}")
set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/amdclang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
Expand Down
4 changes: 2 additions & 2 deletions utilities/rpp-unittests/HIP_NEW/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ if(NOT WIN32)
set(White "${Esc}[37m")
endif()

find_package(hip QUIET)
find_package(HIP QUIET)
find_package(OpenCV QUIET)

# OpenMP
find_package(OpenMP REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

if (hip_FOUND AND OpenCV_FOUND)
if(HIP_FOUND AND OpenCV_FOUND)
message("-- ${Green}${PROJECT_NAME} set to build with rpp, hip and OpenCV${ColourReset}")
set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/amdclang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
Expand Down
40 changes: 29 additions & 11 deletions utilities/test_suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,27 @@ SOFTWARE.
]]

cmake_minimum_required(VERSION 3.10)
project(rpp-test)

# make test with CTest
enable_testing()
include(CTest)

# ROCM Path
if(DEFINED ENV{ROCM_PATH})
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Default ROCm installation path")
elseif(ROCM_PATH)
message("-- ${PROJECT_NAME} INFO:ROCM_PATH Set -- ${ROCM_PATH}")
message("-- INFO:ROCM_PATH Set -- ${ROCM_PATH}")
else()
set(ROCM_PATH /opt/rocm CACHE PATH "Default ROCm installation path")
endif()
# Set AMD Clang as default compiler
if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS "${ROCM_PATH}/bin/amdclang++")
set(CMAKE_C_COMPILER ${ROCM_PATH}/bin/amdclang)
set(CMAKE_CXX_COMPILER ${ROCM_PATH}/bin/amdclang++)
elseif(NOT DEFINED CMAKE_CXX_COMPILER AND NOT EXISTS "${ROCM_PATH}/bin/amdclang++")
set(CMAKE_CXX_COMPILER clang++)
endif()

project(rpp-test)
# make test with CTest
enable_testing()
include(CTest)

# Set message options
if(NOT WIN32)
Expand Down Expand Up @@ -66,6 +73,8 @@ List of high level dependency checks - for RPP QA tests in utilities/test_suite/
- OpenCV (For IMAGE and VOXEL tests - to decode image inputs and write images for unit test outputs)
- TurboJPEG (For IMAGE tests - to decode image inputs)
]]
# add find modules
list(APPEND CMAKE_MODULE_PATH ${ROCM_PATH}/share/rpp/test/cmake)

# find RPP
find_library(RPP_LIBRARY NAMES rpp HINTS ${ROCM_PATH}/lib)
Expand All @@ -91,6 +100,7 @@ else()
elseif(NOT DEFINED BACKEND)
set(BACKEND "CPU")
endif()
message("-- ${White}${PROJECT_NAME}: Using RPP Backend: ${BACKEND}${ColourReset}")

# RPP installation - Audio support check
set(RPP_AUDIO_AUGMENTATIONS_SUPPORT_FOUND 0)
Expand Down Expand Up @@ -123,7 +133,7 @@ else()
if(Python3_FOUND)
if (PANDAS_FOUND EQUAL 0)
if(OpenMP_FOUND)

message("-- ${White}${PROJECT_NAME}: Adding RPP HOST tests${ColourReset}")
# HOST test set 1 - rpp_qa_tests_tensor_host_all - HOST Tensor-Image QA PASS/FAIL tests
if(TurboJpeg_FOUND)
if(OpenCV_FOUND)
Expand Down Expand Up @@ -177,9 +187,17 @@ else()
)

if( "${BACKEND}" STREQUAL "HIP")
find_package(hip QUIET)
if(hip_FOUND)

if(NOT DEFINED HIP_PATH)
if(NOT DEFINED ENV{HIP_PATH})
set(HIP_PATH ${ROCM_PATH} CACHE PATH "Path to which HIP has been installed")
else()
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
endif()
endif()
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH} ${ROCM_PATH}/hip)
find_package(HIP QUIET)
if(HIP_FOUND)
message("-- ${White}${PROJECT_NAME}: Adding RPP HIP tests${ColourReset}")
# HIP test set 1 - rpp_qa_tests_tensor_hip_all - HIP Tensor-Image QA PASS/FAIL tests
if(TurboJpeg_FOUND)
if(OpenCV_FOUND)
Expand Down Expand Up @@ -232,7 +250,7 @@ else()
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

endif(hip_FOUND)
endif(HIP_FOUND)
elseif( "${BACKEND}" STREQUAL "OCL")
# TBD: Add OCL Tests
message("-- ${Yellow}${PROJECT_NAME} Warning: OpenCL tests not enabled${ColourReset}")
Expand Down
6 changes: 3 additions & 3 deletions utilities/test_suite/HIP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ else()
endif()

# find required libraries
find_package(hip QUIET)
find_package(HIP QUIET)
set(Python3_FIND_VIRTUALENV FIRST)
find_package(Python3 QUIET)
find_package(NIFTI QUIET)
Expand All @@ -132,7 +132,7 @@ else()
# ERROR_QUIET # added only on HOST
# )

if(hip_FOUND)
if(HIP_FOUND)
message("-- ${Green}HIP found at hip_INCLUDE_DIRS - ${hip_INCLUDE_DIRS} and hip_LIBRARIES - ${hip_LIBRARIES}${ColourReset}")

if(Python3_FOUND)
Expand Down Expand Up @@ -234,7 +234,7 @@ else()
endif(Python3_FOUND)
else()
message("-- ${Red}${PROJECT_NAME} Error: ROCm HIP must be installed to run any RPP test_suite HIP tests successfully${ColourReset}")
endif(hip_FOUND)
endif(HIP_FOUND)
else()
message("-- ${Red}${PROJECT_NAME} is supported to build and run only with RPP HIP backend installation${ColourReset}")
endif("${BACKEND}" STREQUAL "HIP")
Expand Down
2 changes: 1 addition & 1 deletion utilities/test_suite/HIP/Tensor_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char **argv)
bool kernelSizeCase = (testCase == 40 || testCase == 41 || testCase == 49 || testCase == 54);
bool dualInputCase = (testCase == 2 || testCase == 30 || testCase == 33 || testCase == 61 || testCase == 63 || testCase == 65 || testCase == 68);
bool randomOutputCase = (testCase == 6 || testCase == 8 || testCase == 10 || testCase == 84 || testCase == 49 || testCase == 54);
bool nonQACase = (testCase == 24 || || testCase == 28 || testCase == 54);
bool nonQACase = (testCase == 24 || testCase == 28 || testCase == 54);
bool interpolationTypeCase = (testCase == 21 || testCase == 23 || testCase == 24|| testCase == 28 || testCase == 79);
bool reductionTypeCase = (testCase == 87 || testCase == 88 || testCase == 89 || testCase == 90 || testCase == 91);
bool noiseTypeCase = (testCase == 8);
Expand Down

0 comments on commit b4210f1

Please sign in to comment.