Skip to content

Commit

Permalink
CTest - Updates & Additional Tests (#1158)
Browse files Browse the repository at this point in the history
* CTest - Updates & Additional Tests

* CTest - Fix test name

* CTest - Fix GPU Backend

* CTest - NN Tests Added
  • Loading branch information
kiritigowda authored Aug 7, 2023
1 parent 867f932 commit c1ec1c0
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 136 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ endif()
if(NOT DEFINED BACKEND)
set(BACKEND "HIP") # set default backend to HIP
else()
if("${BACKEND}" STREQUAL "OPENCL" OR "${BACKEND}" STREQUAL "OCL" OR "${BACKEND}" STREQUAL "OpenCL")
if("${BACKEND}" STREQUAL "OPENCL" OR "${BACKEND}" STREQUAL "OCL" OR "${BACKEND}" STREQUAL "OpenCL" OR "${BACKEND}" STREQUAL "opencl")
set(BACKEND "OPENCL")
elseif("${BACKEND}" STREQUAL "HIP" OR "${BACKEND}" STREQUAL "hip")
set(BACKEND "HIP")
Expand Down Expand Up @@ -150,7 +150,7 @@ endif()

enable_testing()
include(CTest)
add_subdirectory(tests/openvx)
add_subdirectory(tests/openvx_api_tests)

# set package information
set(CPACK_PACKAGE_VERSION ${VERSION})
Expand Down
7 changes: 6 additions & 1 deletion amd_openvx_extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ if(GPU_SUPPORT)
string(REGEX MATCH "MIOPEN_BACKEND_HIP ([0-9]*)" _ ${MIOPEN_CONFIG_FILE})
set(MIOPEN_BACKEND_HIP_FOUND ${CMAKE_MATCH_1})
else()
message("-- ${Red}WARNING: ${ROCM_PATH}/miopen/include/miopen/config.h file Not Found. please run the setup script to install the MIOpen package ${ColourReset}")
set(NEURAL_NET OFF)
message("-- ${Red}WARNING: ${ROCM_PATH}/include/miopen/config.h file Not Found. please run the setup script to install the MIOpen package ${ColourReset}")
endif()

endif()
Expand Down Expand Up @@ -104,19 +105,23 @@ if (NEURAL_NET)
add_subdirectory(amd_nn)
message("-- ${Green}AMD OpenVX Neural Network Extension -- amd_nn module added with OpenCL backend${ColourReset}")
else()
set(NEURAL_NET OFF)
message("-- ${Red}WARNING: MIOPEN with OpenCL backend Not Found -- amd_nn module excluded${ColourReset}")
endif()
elseif("${BACKEND}" STREQUAL "HIP" AND HIP_FOUND)
if (MIOPEN_BACKEND_HIP_FOUND)
add_subdirectory(amd_nn)
message("-- ${Green}AMD OpenVX Neural Network Extension -- amd_nn module added with HIP backend${ColourReset}")
else()
set(NEURAL_NET OFF)
message("-- ${Red}WARNING: MIOPEN with HIP backend Not Found -- amd_nn module excluded${ColourReset}")
endif()
else()
set(NEURAL_NET OFF)
message("-- ${Red}WARNING: GPU support with OpenCL/MIOpenGEMM(for OpenCL)/HIP Not Found -- amd_nn module excluded${ColourReset}")
endif()
else()
set(NEURAL_NET OFF)
message("-- ${Red}WARNING: GPU_SUPPORT/MIOpen Not Found -- amd_nn module excluded${ColourReset}")
endif()
else()
Expand Down
133 changes: 0 additions & 133 deletions tests/openvx/CMakeLists.txt

This file was deleted.

173 changes: 173 additions & 0 deletions tests/openvx_api_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
################################################################################
#
# MIT License
#
# Copyright (c) 2023 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.
#
################################################################################
cmake_minimum_required (VERSION 3.0)

# default run
# canny
add_test(
NAME
openvx_canny
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/canny"
"${CMAKE_CURRENT_BINARY_DIR}/canny"
--build-generator "${CMAKE_GENERATOR}"
--test-command "openvx_canny"
)

# channel extract
add_test(
NAME
openvx_channel_extract
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/channel_extract"
"${CMAKE_CURRENT_BINARY_DIR}/channel_extract"
--build-generator "${CMAKE_GENERATOR}"
--test-command "openvx_channel_extract"
)

# color convert
add_test(
NAME
openvx_color_convert
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/color_convert"
"${CMAKE_CURRENT_BINARY_DIR}/color_convert"
--build-generator "${CMAKE_GENERATOR}"
--test-command "openvx_color_convert"
)

# CPU Tests
add_test(NAME openvx_canny_CPU
COMMAND openvx_canny
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/canny)
set_property(TEST openvx_canny_CPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=CPU")
add_test(NAME openvx_channel_extract_CPU
COMMAND openvx_channel_extract
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/channel_extract)
set_property(TEST openvx_channel_extract_CPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=CPU")
add_test(NAME openvx_color_convert_CPU
COMMAND openvx_color_convert
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/color_convert)
set_property(TEST openvx_color_convert_CPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=CPU")

set(Python3_FIND_VIRTUALENV FIRST)
find_package(Python3 QUIET)
find_package(OpenCV QUIET)

# OpenVX Tests
if(Python3_FOUND)
add_test(NAME openvx_tests_runVisionPython_CPU
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/vision_tests/runVisionTests.py
--runvx_directory ${CMAKE_BINARY_DIR}/bin --num_frames 10
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(Python3_FOUND)

# OpenCV Tests
if(OpenCV_FOUND AND Python3_FOUND)
add_test(NAME vx_opencv_tests_runOpenCVPython
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/amd_opencv_tests/runOpenCVTests.py
--runvx_directory ${CMAKE_BINARY_DIR}/bin
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(OpenCV_FOUND AND Python3_FOUND)

# GPU Tests
if(GPU_SUPPORT)
# API tests
add_test(NAME openvx_canny_GPU
COMMAND openvx_canny
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/canny)
set_property(TEST openvx_canny_GPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=GPU")
add_test(NAME openvx_channel_extract_GPU
COMMAND openvx_channel_extract
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/channel_extract)
set_property(TEST openvx_channel_extract_CPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=GPU")
add_test(NAME openvx_color_convert_GPU
COMMAND openvx_color_convert
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/color_convert)
set_property(TEST openvx_color_convert_GPU PROPERTY ENVIRONMENT "AGO_DEFAULT_TARGET=GPU")

# OpenVX Tests
if(Python3_FOUND)
add_test(NAME openvx_tests_runVisionPython_GPU
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/vision_tests/runVisionTests.py
--runvx_directory ${CMAKE_BINARY_DIR}/bin --num_frames 10 --hardware_mode GPU --backend_type ${BACKEND}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(Python3_FOUND)

# Neural Network tests
if(NEURAL_NET AND Python3_FOUND)
# caffe2nnir2openvx No Fuse flow
add_test(NAME caffe2nnir2openvx_no_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 1
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# caffe2nnir2openvx Fuse flow
add_test(NAME caffe2nnir2openvx_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 2
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# caffe2nnir2openvx FP16 flow
add_test(NAME caffe2nnir2openvx_fp16
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 3
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# onnx2nnir2openvx No Fuse flow
add_test(NAME onnx2nnir2openvxx_no_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 4
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# onnx2nnir2openvx Fuse flow
add_test(NAME onnx2nnir2openvxx_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 5
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# onnx2nnir2openvx FP16 flow
add_test(NAME onnx2nnir2openvxx_fp16
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 6
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# nnef2nnir2openvx No Fuse flow
add_test(NAME nnef2nnir2openvxx_no_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 7
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# nnef2nnir2openvx Fuse flow
add_test(NAME nnef2nnir2openvxx_fuse
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 8
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# nnef2nnir2openvx FP16 flow
add_test(NAME nnef2nnir2openvxx_fp16
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/neural_network_tests/runNeuralNetworkTests.py
--profiler_mode 9
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(NEURAL_NET AND Python3_FOUND)

endif(GPU_SUPPORT)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c1ec1c0

Please sign in to comment.