Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
88c57b4
made lib compare
Gitubrr Apr 21, 2026
f6c9ff1
added more comparison points
Gitubrr Apr 25, 2026
7419e16
added list of dependences
Gitubrr Apr 28, 2026
21279b0
CI -> +
Gitubrr Apr 29, 2026
e2a2ad1
Just formatting changes to README
Gitubrr Apr 29, 2026
2ed3b03
added config params info
Gitubrr May 4, 2026
fc33885
added config structure
Gitubrr May 4, 2026
d680949
formatting only
Gitubrr May 4, 2026
de27aa7
added performance parameter
Gitubrr May 4, 2026
e0c9b47
formatting only
Gitubrr May 4, 2026
0b8ca49
formatting
Gitubrr May 5, 2026
b880e9e
added 2 libs, removed 'Пакетные менеджеры'
Gitubrr May 5, 2026
e0c730b
added SPLA usage scenarios
Gitubrr May 11, 2026
b5b7580
making defolt scenario
Gitubrr May 19, 2026
af09acd
added 1 question about errors
Gitubrr May 19, 2026
627b027
added new scenaries
Gitubrr Jun 1, 2026
c1b7f2d
added manual
Gitubrr Jul 9, 2026
8c9ddff
Fixed the incorrect format name in 1 example in CONFIGURATION FALE se…
Gitubrr Jul 10, 2026
c90f185
add parsers
Gitubrr Jul 26, 2026
82028eb
fixed formatting errors
Gitubrr Jul 26, 2026
464aaa0
changed cli parser, file parser, made validate
Gitubrr Jul 28, 2026
f8cea29
changed init
Gitubrr Jul 28, 2026
0af1432
made apply() and started changing cl_accelerator.cpp,.hpp + added num…
Gitubrr Jul 29, 2026
73045f1
removed apply(), changed init() -> init(conf)
Gitubrr Jul 29, 2026
a28e55e
for formatter only
Gitubrr Jul 29, 2026
8e333d8
add configuration mechanism
Gitubrr Aug 31, 2026
c9b84f3
made UserManual and UserGuide
Gitubrr Sep 8, 2026
3e87443
unnecessary changes
Gitubrr Sep 8, 2026
aa11385
fixed
Gitubrr Sep 20, 2026
60ecdff
for formatter and ubuntu build
Gitubrr Sep 20, 2026
53fb6c4
changed make file
Gitubrr Sep 20, 2026
5aa6e52
changed deps in make file
Gitubrr Sep 20, 2026
54b10b1
! grep -qE \[ FAILED \]
Gitubrr Sep 20, 2026
24dcab7
CL_TARGET_OPENCL_VERSION=300
Gitubrr Sep 20, 2026
2291458
made verbosity
Gitubrr Sep 22, 2026
3082114
added MIT license back
Gitubrr Sep 23, 2026
0b14b37
add MIT license to cl_configure
Gitubrr Sep 23, 2026
48613f8
made new user guide
Gitubrr Sep 24, 2026
ac5f337
chanjed config structure
Gitubrr Sep 25, 2026
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 .github/workflows/self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:

- name: Check for tests results
run: |
! grep -qi "FAILED" ${{ env.test-file }}
! grep -qE "\[ FAILED \]" ${{ env.test-file }}
clean:
name: Cleanup workspace
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ jobs:

- name: Check for tests results
run: |
! grep -qi "FAILED" ${{ env.test-file }}
! grep -qE "\[ FAILED \]" ${{ env.test-file }}
22 changes: 21 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ endfunction()
add_subdirectory(deps/robin_hood)
add_subdirectory(deps/svector)

message(STATUS "Add CLI11 as CLI/ENV parser")
include(FetchContent)

FetchContent_Declare(CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2
)
FetchContent_MakeAvailable(CLI11)

message(STATUS "Add nlohmann/json as JSON parser")
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3
)
FetchContent_MakeAvailable(nlohmann_json)

if (SPLA_BUILD_OPENCL)
if (SPLA_TARGET_MACOSX)
message(STATUS "Add standard Apple OpenCL package")
Expand Down Expand Up @@ -235,6 +251,8 @@ set(SRC_OPENCL)

if (SPLA_BUILD_OPENCL)
set(SRC_OPENCL
src/opencl/cl_configure.cpp
src/opencl/cl_configure.hpp
src/opencl/cl_debug.hpp
src/opencl/cl_accelerator.cpp
src/opencl/cl_accelerator.hpp
Expand Down Expand Up @@ -371,11 +389,13 @@ target_compile_definitions(spla PRIVATE SPLA_EXPORTS)

target_link_libraries(spla PRIVATE robin_hood)
target_link_libraries(spla PRIVATE svector)
target_link_libraries(spla PRIVATE CLI11::CLI11)
target_link_libraries(spla PRIVATE nlohmann_json::nlohmann_json)

if (SPLA_BUILD_OPENCL)
target_link_libraries(spla PUBLIC OpenCL)
target_link_libraries(spla PUBLIC OpenCL::HeadersCpp)
target_compile_definitions(spla PUBLIC CL_TARGET_OPENCL_VERSION=120)
target_compile_definitions(spla PUBLIC CL_TARGET_OPENCL_VERSION=300)
list(APPEND SPLA_DEFINES SPLA_BUILD_OPENCL)
endif ()

Expand Down
2 changes: 1 addition & 1 deletion deps/opencl-headers/tests/pkgconfig/bare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_link_libraries(${PROJECT_NAME}

target_compile_definitions(${PROJECT_NAME}
PRIVATE
CL_TARGET_OPENCL_VERSION=120
CL_TARGET_OPENCL_VERSION=300
)

include(CTest)
Expand Down
2 changes: 1 addition & 1 deletion deps/opencl-headers/tests/pkgconfig/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ target_link_libraries(${PROJECT_NAME}

target_compile_definitions(${PROJECT_NAME}
PRIVATE
CL_TARGET_OPENCL_VERSION=120
CL_TARGET_OPENCL_VERSION=300
)

include(CTest)
Expand Down
2 changes: 1 addition & 1 deletion deps/opencl-icd-loader/test/pkgconfig/bare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_link_libraries(${PROJECT_NAME}

target_compile_definitions(${PROJECT_NAME}
PRIVATE
CL_TARGET_OPENCL_VERSION=120
CL_TARGET_OPENCL_VERSION=300
)

include(CTest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ target_compile_options(${PROJECT_NAME}

target_compile_definitions(${PROJECT_NAME}
PRIVATE
CL_TARGET_OPENCL_VERSION=120
CL_TARGET_OPENCL_VERSION=300
)

include(CTest)
Expand Down
2 changes: 1 addition & 1 deletion deps/opencl-icd-loader/test/pkgconfig/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ target_link_libraries(${PROJECT_NAME}

target_compile_definitions(${PROJECT_NAME}
PRIVATE
CL_TARGET_OPENCL_VERSION=120
CL_TARGET_OPENCL_VERSION=300
)

include(CTest)
Expand Down
15 changes: 15 additions & 0 deletions include/spla/library.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ namespace spla {
*/
SPLA_API Status set_message_callback(MessageCallback callback);

/**
* @brief Set verbosity level for library logger
*
* Controls which messages are shown:
* 0 - no output
* 1 - errors only
* 2 - errors + warnings
* 3 - all messages (info, warnings, errors)
*
* @param verbosity Verbosity level [0, 3]
*
* @return Function call status
*/
SPLA_API Status set_verbosity(int verbosity);

/**
* @brief Sets default library callback to log messages to console
*
Expand Down
37 changes: 35 additions & 2 deletions src/core/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,48 @@

namespace spla {

void Logger::log_msg(Status status, const std::string& msg, const std::string& file, const std::string& function, int line) {
static int status_to_level(Status status) {
switch (status) {
case Status::Error:
case Status::PlatformNotFound:
case Status::DeviceNotFound:
case Status::InvalidArgument:
case Status::CompilationError:
return 1;

case Status::NoAcceleration:
case Status::InvalidState:
case Status::NoValue:
case Status::NotImplemented:
return 2;

case Status::Ok:
default:
return 3;
}
}

void Logger::log_msg(Status status, const std::string& msg,
const std::string& file, const std::string& function, int line) {

int level = status_to_level(status);
if (level > m_verbosity) return;

std::lock_guard guard(m_mutex);
std::filesystem::path file_path(file);
if (m_callback) m_callback(status, msg, file_path.filename().string(), function, line);
if (m_callback) {
m_callback(status, msg, file_path.filename().string(), function, line);
}
}

void Logger::set_msg_callback(MessageCallback callback) {
std::lock_guard guard(m_mutex);
m_callback = std::move(callback);
}

void Logger::set_verbosity(int verbosity) {
std::lock_guard guard(m_mutex);
m_verbosity = verbosity;
}

}// namespace spla
5 changes: 3 additions & 2 deletions src/core/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ namespace spla {
public:
void log_msg(Status status, const std::string& msg, const std::string& file, const std::string& function, int line);
void set_msg_callback(MessageCallback callback);
void set_verbosity(int verbosity);

private:
MessageCallback m_callback;

MessageCallback m_callback;
int m_verbosity = 3;
mutable std::mutex m_mutex;
};

Expand Down
6 changes: 6 additions & 0 deletions src/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ namespace spla {
return Status::Ok;
}

Status Library::set_verbosity(int verbosity) {
m_logger->set_verbosity(verbosity);
LOG_MSG(Status::Ok, "set verbosity: " << verbosity);
return Status::Ok;
}

Status Library::set_default_callback() {
auto callback = [](spla::Status status,
const std::string& msg,
Expand Down
126 changes: 126 additions & 0 deletions src/opencl/LibsCompare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Сравнение библиотек для создания механизма конфигурирования
Вся информация взята из репозиториев соответствующих проектов. Дата обращения: 21.04.26.

## Критерии сравнения

| Критерий | Метрика | Единицы измерения |
|:---|:---|:---|
| **Зависимости** | наличие | +/- |
| **Источники** | CLI (argv) / env / файлы | +/-, форматы |
| **Стандарт C++** | минимальная версия | C++хх |
| **Поддерживает стандарт иерархии** | Linux/Windows/MacOS | +/- |
| **Способ распространения** | header-only / статическая / динамическая | — |
| **ОС** | Linux / Windows / macOS | +/-, компиляторы |
| **Активность** | среднее число коммитов | коммитов/мес (за последний мес) |
| **Issues** | open, closed/open | n, коэффициент |
| **Сообщество** | GitHub Stars | n |
| **Проходит ли CI** | CI | +/- |

> ? - не указано в README.


## Сравнение парсеров командной строки (CLI)

| Критерий | CLI11 | cxxopts |
|:---|:---:|:---:|
| Зависимости | - | - |
| **Источники** | | |
| &emsp;CLI (argv) | + | + |
| &emsp;env | + | - |
| &emsp;Файлы | - | - |
| Стандарт C++ | &ge; C++11 | &ge; C++11 |
| **Поддерживает стандарт иерархии** | | |
| &emsp;Linux | + | + |
| &emsp;Windows | + | + |
| &emsp;MacOS | + | + |
| Способ распространения | header-only | header-only
| **ОС** | | |
| &emsp;Linux | + (GCC 4.8+, Clang 3.5+) | + (GCC ≥ 4.9, Clang ≥ 3.1) |
| &emsp;Windows | + (MSVC ≥ 2015) | + (MSVC ≥ 2015) |
| &emsp;macOS | + (AppleClang 7+) | + (Clang ≥ 3.1 с libc++) |
| **Сообщество** | | |
| &emsp;Активность (коммитов/мес) | 4 | 1 |
| &emsp;Issues всего | 506 | 307 |
| &emsp;Issues closed/open | 9 | 6 |
| &emsp;Stars | 4.3k | 4.7k |
| Проходит ли CI | + | + | + |


## Парсеры файлов

| Критерий | nlohmann/json | yaml-cpp | toml++ | toml11 | config-cxx | taocpp/config
|:---|:---:|:---:|:---:|:---:|:---:|:---:|
| Зависимости | - | - | - | - | - | - |
| **Источники** |
| &emsp;CLI (argv) | - | - | - | - | - | - |
| &emsp;env | - | - | - | - | + | + |
| &emsp;Файлы | JSON | YAML | TOML | TOML | JSON, YAML, XML | JSON, JAXN |
| Стандарт C++ | &ge; C++11 | &ge; C++11 | &ge; C++17 | &ge; C++11 | &ge; C++20 | &ge; C++17 |
| **Поддерживает стандарт иерархии** |
| &emsp;Linux | + | + | + | + | + | + |
| &emsp;Windows | + | + | + | + | + | + |
| &emsp;MacOS | + | + | + | + | + | + |
| Способ распространения | header-only | статическая/динамическая¹ | header-only/статическая/динамическая¹ | header-only/статическая/динамическая¹ | header-only | header-only |
| **ОС** | | |
| &emsp;Linux | + (GCC 4.8–14.2, Clang 3.4–21.0) | + (GCC, Clang) | + (Clang 8+, GCC 8+) | + (GCC, Clang) | + (GCC 13+, Clang 16+) | +
| &emsp;Windows | + (MSVC 2015–2022) | + (MSVC) | + (MSVC VS2019+) | + (MSVC, MinGW) | + (MSVC 143+ (VS 2022)) | +
| &emsp;macOS | + (AppleClang 9.1–16.0) | + (Xcode, AppleClang) | + (AppleClang) | + (AppleClang) | + (AppleClang 16+) | +
| **Сообщество** | | |
| &emsp;Активность (коммитов/мес) | 2 | 9 | 2 | 4 | 2 | 13 |
| &emsp;Issues всего | 3271 | 905 | 193 | 194 | 24 | 5 |
| &emsp;Issues closed/open | 68 | 3 | 8 | 5 | 0 open | 0 open |
| &emsp;Stars | 49.4k | 15k | 2k | 1.3k | 31 | 194 |
| Проходит ли CI | + | + | + | - | + | ? |

> ¹ Опционально.

## Сравнение универсальных инструментов

| Критерий | Boost.Program_options
|:---|:---:|
| Зависимости | +¹ |
| **Источники** | | |
| &emsp;CLI (argv) | + | + |
| &emsp;env | + | + |
| &emsp;Файлы | INI |
| Стандарт C++ | &ge; C++3 |
| **Поддерживает стандарт иерархии** | | |
| &emsp;Linux | + |
| &emsp;Windows | + |
| &emsp;MacOS | + |
| Способ распространения | статическая/динамическая² |
| **ОС** | | |
| &emsp;Linux | + (GCC 5+, Clang 3.6+) |
| &emsp;Windows | + (MSVC 2015 (vc140)+) |
| &emsp;macOS | + (AppleClang) |
| **Сообщество** | | |
| &emsp;Активность (коммитов/мес) | 12 |
| &emsp;Issues всего | 400 |
| &emsp;Issues closed/open | 1 |
| &emsp;Stars | 9.4k |
| Проходит ли CI | + | + |

> ¹ Список зависимостей:
> 1. Boost.Any
> 2. Boost.Bind
> 3. Boost.Config
> 4. Boost.Core
> 5. Boost.Detail
> 6. Boost.Function
> 7. Boost.Iterator
> 8. Boost.Lexical Cast
> 9. Boost.Smart Ptr
> 10. Boost.ThrowException
> 11. Boost.Tokenizer
> 12. Boost.Type Traits

> ² Опционально.


### Итог:
По результатам сравнения, вероятно, лучшим вариантом будет использование `CLI11` и `nlohmann/json`, так как они, в отличие от `Boost.program_options`, не требуют зависимостей и являются header-only.


# Механизм конфигурирования библиотеки SPLA

Механизм конфигурирования описывается в разделах: [Мануал пользователя](#UserManual) и [Руководство пользователя](#UserGuide)
Loading
Loading