Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/static-analysis-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
id: review
with:
build_dir: build
apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind,libopencv-dev
apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind
cmake_command: >
cmake -S . -B build
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
Expand All @@ -30,7 +30,6 @@ jobs:
-D USE_SEQ=ON -D USE_MPI=ON
-D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-D USE_SYSTEM_OPENCV=ON
config_file: .clang-tidy
exclude: 3rdparty
split_workflow: true
Expand Down Expand Up @@ -59,7 +58,7 @@ jobs:
id: review
with:
build_dir: build
apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind,libopencv-dev
apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind
cmake_command: >
cmake -S . -B build
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
Expand All @@ -68,7 +67,6 @@ jobs:
-D USE_SEQ=ON -D USE_MPI=ON
-D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-D USE_SYSTEM_OPENCV=ON
config_file: .clang-tidy
exclude: 3rdparty
split_workflow: true
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "3rdparty/onetbb"]
path = 3rdparty/onetbb
url = https://github.com/uxlfoundation/oneTBB
[submodule "3rdparty/opencv"]
path = 3rdparty/opencv
url = https://github.com/opencv/opencv
1 change: 0 additions & 1 deletion 3rdparty/opencv
Submodule opencv deleted from 31b0ee
7,898 changes: 7,898 additions & 0 deletions 3rdparty/stb/stb_image.h
Comment thread
allnes marked this conversation as resolved.
Outdated

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ include(cmake/onetbb.cmake)
######################### External projects #########################

message( STATUS "PPC step: Setup external projects" )
include(cmake/opencv.cmake)
include(cmake/gtest.cmake)

########################### Documentation ###########################
Expand Down
2 changes: 1 addition & 1 deletion cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if( UNIX )
-Wold-style-definition \
-Wmissing-prototypes")

if (${ENABLE_ADDRESS_SANITIZER} OR ${ENABLE_UB_SANITIZER})
if ("${ENABLE_ADDRESS_SANITIZER}" OR "${ENABLE_UB_SANITIZER}")
set (COMMON_COMPILER_FLAGS "${COMMON_COMPILER_FLAGS} -Wno-cast-align")
endif()

Expand Down
45 changes: 0 additions & 45 deletions cmake/opencv.cmake

This file was deleted.

4 changes: 4 additions & 0 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ add_dependencies(${exec_func_tests} ppc_googletest)
target_link_directories(${exec_func_tests} PUBLIC ${CMAKE_BINARY_DIR}/ppc_googletest/install/lib)
target_link_libraries(${exec_func_tests} PUBLIC gtest gtest_main)

add_library(stb_image INTERFACE)
target_include_directories(stb_image INTERFACE ${CMAKE_SOURCE_DIR}/3rdparty/stb/stb_image.h)
Comment thread
allnes marked this conversation as resolved.
Outdated
target_link_libraries(${exec_func_tests} PUBLIC stb_image)

target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib})

enable_testing()
Expand Down
2 changes: 2 additions & 0 deletions modules/core/util/include/util.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#pragma once
#include <string>
#include <vector>

namespace ppc::util {

std::string GetAbsolutePath(const std::string &relative_path);
int GetPPCNumThreads();
bool GetImageData(const std::string &abs_path, std::vector<uint8_t> &image, int &width, int &height, int &channels);

} // namespace ppc::util
20 changes: 19 additions & 1 deletion modules/core/util/src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
#include <cstdint>
#include <iostream>
#include <memory>
#include <vector>
#endif

#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>

#include <filesystem>
#include <iostream>
#include <string>

std::string ppc::util::GetAbsolutePath(const std::string &relative_path) {
Expand All @@ -31,3 +34,18 @@ int ppc::util::GetPPCNumThreads() {
#endif
return num_threads;
}

bool ppc::util::GetImageData(const std::string &abs_path, std::vector<uint8_t> &image, int &width, int &height,
int &channels) {
width = -1;
height = -1;
channels = -1;
unsigned char *data = stbi_load(abs_path.c_str(), &width, &height, &channels, 0);
if (data == nullptr) {
std::cerr << "Failed to load image: " << stbi_failure_reason() << '\n';
return false;
}
image = std::vector<uint8_t>(data, data + (width * height * channels));
stbi_image_free(data);
return true;
}
20 changes: 0 additions & 20 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ def __init__(self):
self.work_dir = None
self.valgrind_cmd = "valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all"

if platform.system() == "Windows":
self.ocv_script_name = "setup_vars_opencv4.cmd"
self.ocv_script_path = Path("build/ppc_opencv/install/") / self.ocv_script_name
else:
self.ocv_script_name = "setup_vars_opencv4.sh"
self.ocv_script_path = Path("build/ppc_opencv/install/bin/") / self.ocv_script_name

if platform.system() == "Windows":
self.mpi_exec = "mpiexec"
else:
Expand Down Expand Up @@ -65,18 +58,6 @@ def __source_script(script_path):
print(f"Failed to source script: {script_path}")
return {}

def setup_env(self):
if os.path.isfile(Path(self.__get_project_path()) / self.ocv_script_path):
_work_dir = Path(self.__get_project_path()) / "build/bin"
env_vars = self.__source_script(Path(self.__get_project_path()) / self.ocv_script_path)
else:
_work_dir = Path(self.__get_project_path()) / "install/bin"
env_vars = self.__source_script(Path(_work_dir) / self.ocv_script_name)

self.work_dir = Path(_work_dir)
if not platform.system() == "Windows":
os.environ.update(env_vars)

@staticmethod
def __run_exec(command):
result = subprocess.run(command, shell=True, env=os.environ)
Expand Down Expand Up @@ -149,7 +130,6 @@ def run_performance_list(self):
args_dict = init_cmd_args()

ppc_runner = PPCRunner()
ppc_runner.setup_env()

if args_dict["running_type"] in ["threads", "processes"]:
ppc_runner.run_core()
Expand Down
22 changes: 0 additions & 22 deletions tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,6 @@ foreach(TASK_TYPE ${LIST_OF_TASKS})
endif()
endif ()

add_dependencies(${EXEC_FUNC} ppc_opencv)
if(WIN32)
target_include_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_opencv/install/include")
else()
target_include_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_opencv/install/include/opencv4")
endif()


if(WIN32)
target_link_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_opencv/build/lib")
set(OCV_VERSION "4110")
else()
target_link_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_opencv/install/lib")
endif()

target_link_libraries(${EXEC_FUNC} PUBLIC
opencv_core${OCV_VERSION}
opencv_highgui${OCV_VERSION}
opencv_imgcodecs${OCV_VERSION}
opencv_imgproc${OCV_VERSION}
opencv_videoio${OCV_VERSION})

add_dependencies(${EXEC_FUNC} ppc_googletest)
target_link_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_googletest/install/lib")
target_link_libraries(${EXEC_FUNC} PUBLIC gtest gtest_main)
Expand Down
13 changes: 9 additions & 4 deletions tasks/all/example/func_tests/func_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <opencv2/opencv.hpp>
#include <vector>

#include "all/example/include/ops_all.hpp"
Expand Down Expand Up @@ -38,9 +37,15 @@ TEST(nesterov_a_test_task_all, test_matmul_50) {
}

TEST(nesterov_a_test_task_all, test_matmul_from_pic) {
cv::Mat img = cv::imread(ppc::util::GetAbsolutePath("all/example/data/pic_all.jpg"));
EXPECT_EQ(img.rows, img.cols);
const int count = (img.rows + img.cols) / 10;
int width = -1;
int height = -1;
int channels = -1;
std::vector<uint8_t> img;

EXPECT_TRUE(ppc::util::GetImageData(ppc::util::GetAbsolutePath("all/example/data/pic_all.jpg"), img, width, height,
channels));
EXPECT_EQ(width, height);
const int count = (width + height) / 10;

// Create data
std::vector<int> in(count * count, 0);
Expand Down
Loading