Skip to content

Commit cb4a446

Browse files
committed
Fix CI regressions in static analysis and SYCL
1 parent 4b8b3de commit cb4a446

6 files changed

Lines changed: 46 additions & 24 deletions

File tree

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ jobs:
2727
cmake --build build --parallel
2828
- name: Run clang-tidy
2929
run: |
30-
clang-tidy app/**/*.cpp src/**/*.cpp -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build
30+
mapfile -t sources < <(find app src -path 'app/SYCL' -prune -o -name '*.cpp' -print)
31+
clang-tidy "${sources[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build

app/SYCL/.clang-tidy

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
11
Checks: '-*,misc-unused-parameters'
22
WarningsAsErrors: ''
3-
ExtraArgs:
4-
- -std=c++20
5-
- -Iinclude
6-
- -Iapp
7-
- -I3rdparty/TBB/include
8-
- -I3rdparty/kokkos/core/src
9-
- -I3rdparty/kokkos/containers/src
10-
- -I3rdparty/kokkos/algorithms/src
11-
- -I3rdparty/kokkos/simd/src
12-
- -Ibuild/3rdparty/kokkos_install/include

cmake/opencv_config.cmake

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,33 @@ string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1"
9090
set(OPENCV_WORLD_TARGET_NAME "opencv_world")
9191
set(OPENCV_WORLD_IMPORT_NAME "${OPENCV_WORLD_TARGET_NAME}")
9292
set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_TARGET_NAME}")
93+
set(OPENCV_INSTALL_BINARIES_PREFIX "")
9394

9495
if(WIN32)
96+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
97+
set(OPENCV_ARCH x64)
98+
else()
99+
set(OPENCV_ARCH x86)
100+
endif()
101+
102+
if(MSVC)
103+
if(MSVC_VERSION GREATER_EQUAL 1930)
104+
set(OPENCV_RUNTIME vc17)
105+
elseif(MSVC_VERSION GREATER_EQUAL 1920)
106+
set(OPENCV_RUNTIME vc16)
107+
elseif(MSVC_VERSION GREATER_EQUAL 1910)
108+
set(OPENCV_RUNTIME vc15)
109+
else()
110+
set(OPENCV_RUNTIME vc14)
111+
endif()
112+
elseif(MINGW)
113+
set(OPENCV_RUNTIME mingw)
114+
endif()
115+
116+
if(DEFINED OPENCV_ARCH AND DEFINED OPENCV_RUNTIME)
117+
set(OPENCV_INSTALL_BINARIES_PREFIX "${OPENCV_ARCH}/${OPENCV_RUNTIME}/")
118+
endif()
119+
95120
set(OPENCV_WORLD_IMPORT_NAME
96121
"${OPENCV_WORLD_TARGET_NAME}${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
97122
set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_IMPORT_NAME}")
@@ -101,8 +126,10 @@ if(WIN32)
101126
endif()
102127
endif()
103128

104-
set(OPENCV_LIBRARY_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}")
105-
set(OPENCV_RUNTIME_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_BINDIR}")
129+
set(OPENCV_LIBRARY_DIR
130+
"${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_LIBDIR}")
131+
set(OPENCV_RUNTIME_DIR
132+
"${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_BINDIR}")
106133
set(OPENCV_INCLUDE_DIR "${OPENCV_INSTALL_DIR}/include/opencv4")
107134

108135
if(WIN32)

include/perf/benchmarking.hpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <cmath>
88
#include <numeric>
99
#include <stdexcept>
10+
#include <utility>
1011
#include <vector>
1112

1213
namespace it_lab_ai {
@@ -16,7 +17,7 @@ template <typename DurationContainerType, typename DurationType, class Function,
1617
DurationContainerType elapsed_time(Function&& func, Args&&... args) {
1718
auto duration = std::chrono::duration<DurationContainerType, DurationType>();
1819
auto start = std::chrono::high_resolution_clock::now();
19-
func(args...);
20+
std::forward<Function>(func)(std::forward<Args>(args)...);
2021
auto end = std::chrono::high_resolution_clock::now();
2122
duration = end - start;
2223
return duration.count();
@@ -26,7 +27,7 @@ DurationContainerType elapsed_time(Function&& func, Args&&... args) {
2627
template <class Function, typename... Args>
2728
double elapsed_time_omp(Function&& func, Args&&... args) {
2829
double start = omp_get_wtime();
29-
func(args...);
30+
std::forward<Function>(func)(std::forward<Args>(args)...);
3031
double end = omp_get_wtime();
3132
return end - start;
3233
}
@@ -38,7 +39,7 @@ DurationContainerType elapsed_time_avg(const size_t iters, Function&& func,
3839
auto duration = std::chrono::duration<DurationContainerType, DurationType>();
3940
auto start = std::chrono::high_resolution_clock::now();
4041
for (size_t i = 0; i < iters; i++) {
41-
func(args...);
42+
std::forward<Function>(func)(std::forward<Args>(args)...);
4243
}
4344
auto end = std::chrono::high_resolution_clock::now();
4445
duration = (end - start) / iters;
@@ -51,7 +52,7 @@ double elapsed_time_omp_avg(const size_t iters, Function&& func,
5152
Args&&... args) {
5253
double start = omp_get_wtime();
5354
for (size_t i = 0; i < iters; i++) {
54-
func(args...);
55+
std::forward<Function>(func)(std::forward<Args>(args)...);
5556
}
5657
double end = omp_get_wtime();
5758
return (end - start) / iters;
@@ -61,26 +62,29 @@ template <typename ThroughputContainerType, typename DurationType,
6162
class Function, typename... Args>
6263
ThroughputContainerType throughput(Function&& func, Args&&... args) {
6364
return ThroughputContainerType(1) /
64-
elapsed_time<ThroughputContainerType, DurationType>(func, args...);
65+
elapsed_time<ThroughputContainerType, DurationType>(
66+
std::forward<Function>(func), std::forward<Args>(args)...);
6567
}
6668

6769
template <class Function, typename... Args>
6870
double throughput_omp(Function&& func, Args&&... args) {
69-
return 1 / elapsed_time_omp(func, args...);
71+
return 1 / elapsed_time_omp(std::forward<Function>(func),
72+
std::forward<Args>(args)...);
7073
}
7174

7275
template <typename ThroughputContainerType, typename DurationType,
7376
class Function, typename... Args>
7477
ThroughputContainerType throughput_avg(const size_t iters, Function&& func,
7578
Args&&... args) {
7679
return ThroughputContainerType(1) /
77-
elapsed_time_avg<ThroughputContainerType, DurationType>(iters, func,
78-
args...);
80+
elapsed_time_avg<ThroughputContainerType, DurationType>(
81+
iters, std::forward<Function>(func), std::forward<Args>(args)...);
7982
}
8083

8184
template <class Function, typename... Args>
8285
double throughput_omp_avg(const size_t iters, Function&& func, Args&&... args) {
83-
return 1 / elapsed_time_omp_avg(iters, func, args...);
86+
return 1 / elapsed_time_omp_avg(iters, std::forward<Function>(func),
87+
std::forward<Args>(args)...);
8488
}
8589

8690
// as "Manhattan" norm of error-vector

scripts/ci/sycl-x86-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ else
156156
exit 1
157157
fi
158158

159-
write_env ITLABAI_OPENMP_FLAGS -qopenmp
159+
write_env ITLABAI_OPENMP_FLAGS -fopenmp
160160
write_env ITLABAI_OPENMP_LIBRARY "${openmp_library}"
161161
fi
162162

src/Weights_Reader/reader_weights.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "Weights_Reader/reader_weights.hpp"
1+
#include "Weights_Reader/reader_weights.hpp"
22

33
#include <fstream>
44
#include <iostream>

0 commit comments

Comments
 (0)