Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ CheckOptions:
value: 1
# Functions with scores beyond 15 are typically flagged as potentially problematic (empirically)
- key: readability-function-cognitive-complexity.Threshold
value: 15 # default: 25
value: 20 # default: 25
- key: misc-include-cleaner.IgnoreHeaders
value: '(opencv2/.*|__chrono/.*)'
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[submodule "3rdparty/onetbb"]
path = 3rdparty/onetbb
url = https://github.com/uxlfoundation/oneTBB
[submodule "3rdparty/opencv"]
path = 3rdparty/opencv
url = https://github.com/opencv/opencv
[submodule "3rdparty/stb"]
path = 3rdparty/stb
url = https://github.com/nothings/stb
1 change: 0 additions & 1 deletion 3rdparty/opencv
Submodule opencv deleted from 31b0ee
1 change: 1 addition & 0 deletions 3rdparty/stb
Submodule stb added at 802cd4
13 changes: 13 additions & 0 deletions 3rdparty/stb_library.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#if defined(__clang__)
#pragma clang diagnostic push
Comment thread
allnes marked this conversation as resolved.
#pragma clang diagnostic ignored "-Wcast-align"
#endif

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

#if defined(__clang__)
#pragma clang diagnostic pop
#endif
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
6 changes: 5 additions & 1 deletion cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ else ()
endif ()

set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
set(CMAKE_SKIP_BUILD_RPATH OFF)

if( UNIX )
set(COMMON_COMPILER_FLAGS
Expand Down Expand Up @@ -52,7 +56,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.

18 changes: 1 addition & 17 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 @@ -66,16 +59,7 @@ def __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)
self.work_dir = Path(self.__get_project_path()) / "install" / "bin"

@staticmethod
def __run_exec(command):
Expand Down
25 changes: 4 additions & 21 deletions tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ endif ()

add_compile_definitions(PATH_TO_PPC_PROJECT="${CMAKE_SOURCE_DIR}")

add_library(stb_image INTERFACE)

foreach(TASK_TYPE ${LIST_OF_TASKS})
set(PATH_TO_TASK "${CMAKE_CURRENT_SOURCE_DIR}/${TASK_TYPE}")
get_filename_component(MODULE_NAME ${PATH_TO_TASK} NAME)
Expand Down Expand Up @@ -130,27 +132,8 @@ 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})
target_link_directories(stb_image INTERFACE ${CMAKE_SOURCE_DIR}/3rdparty/stb)
target_link_libraries(${EXEC_FUNC} PUBLIC stb_image)

add_dependencies(${EXEC_FUNC} ppc_googletest)
target_link_directories(${EXEC_FUNC} PUBLIC "${CMAKE_BINARY_DIR}/ppc_googletest/install/lib")
Expand Down
17 changes: 13 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,8 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <opencv2/opencv.hpp>
#include <stb_library.hpp>
#include <string>
#include <vector>

#include "all/example/include/ops_all.hpp"
Expand Down Expand Up @@ -38,9 +39,17 @@ 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::string abs_path = ppc::util::GetAbsolutePath("all/example/data/pic_all.jpg");
unsigned char *data = stbi_load(abs_path.c_str(), &width, &height, &channels, 0);
EXPECT_TRUE(data != nullptr) << "Failed to load image: " << stbi_failure_reason() << '\n';
auto img = std::vector<uint8_t>(data, data + (width * height * channels));
stbi_image_free(data);

EXPECT_EQ(width, height);
const int count = (width + height) / 10;

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