Skip to content

Commit fd5e851

Browse files
Initial import by Dimitrios Kafetzis
0 parents  commit fd5e851

69 files changed

Lines changed: 11033 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
IndentWidth: 4
5+
ColumnLimit: 100
6+
AccessModifierOffset: -4
7+
AllowShortFunctionsOnASingleLine: Inline
8+
AllowShortIfStatementsOnASingleLine: Never
9+
AllowShortLoopsOnASingleLine: false
10+
BreakBeforeBraces: Attach
11+
IncludeBlocks: Regroup
12+
IncludeCategories:
13+
- Regex: '^"core/'
14+
Priority: 1
15+
- Regex: '^"'
16+
Priority: 2
17+
- Regex: '^<'
18+
Priority: 3
19+
PointerAlignment: Left
20+
SortIncludes: CaseSensitive
21+
SpaceAfterCStyleCast: false
22+
SpaceAfterTemplateKeyword: true
23+
SpaceBeforeParens: ControlStatements
24+
Standard: c++20
25+
...

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-x86:
11+
runs-on: ubuntu-24.04
12+
strategy:
13+
matrix:
14+
build_type: [Debug, Release]
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y \
22+
protobuf-compiler \
23+
libprotobuf-dev \
24+
cmake \
25+
g++-13
26+
27+
- name: Configure
28+
run: |
29+
cmake -B build \
30+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
31+
-DCMAKE_CXX_COMPILER=g++-13 \
32+
-DBUILD_TESTS=ON
33+
34+
- name: Build
35+
run: cmake --build build -j$(nproc)
36+
37+
- name: Test
38+
run: cd build && ctest --output-on-failure --timeout 120
39+
40+
build-arm64:
41+
runs-on: ubuntu-24.04
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Install cross-compiler
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y \
49+
g++-13-aarch64-linux-gnu \
50+
protobuf-compiler \
51+
libprotobuf-dev
52+
53+
- name: Configure (cross-compile)
54+
run: |
55+
cmake -B build-arm \
56+
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake \
57+
-DCMAKE_BUILD_TYPE=Release \
58+
-DBUILD_TESTS=OFF
59+
60+
- name: Build
61+
run: cmake --build build-arm -j$(nproc)
62+
63+
sanitizers:
64+
runs-on: ubuntu-24.04
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install dependencies
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y \
72+
protobuf-compiler \
73+
libprotobuf-dev \
74+
cmake \
75+
g++-13
76+
77+
- name: Build with ASan + UBSan
78+
run: |
79+
cmake -B build-san \
80+
-DCMAKE_CXX_COMPILER=g++-13 \
81+
-DENABLE_SANITIZERS=ON \
82+
-DBUILD_TESTS=ON
83+
cmake --build build-san -j$(nproc)
84+
85+
- name: Test with sanitizers
86+
run: cd build-san && ctest --output-on-failure --timeout 120

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Build directories
2+
build/
3+
build-*/
4+
cmake-build-*/
5+
6+
# IDE
7+
.idea/
8+
.vscode/
9+
*.swp
10+
*.swo
11+
*~
12+
.cache/
13+
14+
# Compiled
15+
*.o
16+
*.a
17+
*.so
18+
*.dylib
19+
20+
# Generated
21+
*.pb.h
22+
*.pb.cc
23+
compile_commands.json
24+
25+
# Logs
26+
logs/
27+
*.ndjson
28+
29+
# OS
30+
.DS_Store
31+
Thumbs.db

CMakeLists.txt

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
cmake_minimum_required(VERSION 3.22)
2+
project(EdgeOrchestrator
3+
VERSION 1.0.0
4+
DESCRIPTION "Distributed adaptive resource orchestrator for edge AI workloads"
5+
LANGUAGES CXX
6+
)
7+
8+
# ──────────────────────────────────────────────
9+
# Global Settings
10+
# ──────────────────────────────────────────────
11+
set(CMAKE_CXX_STANDARD 20)
12+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13+
set(CMAKE_CXX_EXTENSIONS OFF)
14+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
15+
16+
# ──────────────────────────────────────────────
17+
# Options
18+
# ──────────────────────────────────────────────
19+
option(BUILD_TESTS "Build unit and integration tests" ON)
20+
option(BUILD_TOOLS "Install Python analysis tools" OFF)
21+
option(ENABLE_SANITIZERS "Enable AddressSanitizer + UBSan" OFF)
22+
option(CROSS_COMPILE_ARM "Cross-compile for ARM64 (Raspberry Pi)" OFF)
23+
24+
# ──────────────────────────────────────────────
25+
# Compiler Warnings
26+
# ──────────────────────────────────────────────
27+
add_compile_options(
28+
-Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor
29+
-Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual
30+
-Wconversion -Wsign-conversion -Wnull-dereference
31+
-Wformat=2 -Wimplicit-fallthrough
32+
)
33+
34+
if(ENABLE_SANITIZERS)
35+
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
36+
add_link_options(-fsanitize=address,undefined)
37+
endif()
38+
39+
# ──────────────────────────────────────────────
40+
# Dependencies
41+
# ──────────────────────────────────────────────
42+
include(FetchContent)
43+
44+
# Protobuf
45+
find_package(Protobuf REQUIRED)
46+
47+
# nlohmann/json (header-only, for telemetry)
48+
FetchContent_Declare(
49+
json
50+
GIT_REPOSITORY https://github.com/nlohmann/json.git
51+
GIT_TAG v3.11.3
52+
)
53+
FetchContent_MakeAvailable(json)
54+
55+
# toml++ (header-only, for config)
56+
FetchContent_Declare(
57+
tomlplusplus
58+
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
59+
GIT_TAG v3.4.0
60+
)
61+
FetchContent_MakeAvailable(tomlplusplus)
62+
63+
if(BUILD_TESTS)
64+
FetchContent_Declare(
65+
googletest
66+
GIT_REPOSITORY https://github.com/google/googletest.git
67+
GIT_TAG v1.14.0
68+
)
69+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
70+
FetchContent_MakeAvailable(googletest)
71+
enable_testing()
72+
endif()
73+
74+
# ──────────────────────────────────────────────
75+
# Protobuf Code Generation
76+
# ──────────────────────────────────────────────
77+
set(PROTO_FILES proto/protocol.proto)
78+
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
79+
80+
# Generated headers go into build dir
81+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
82+
83+
# ──────────────────────────────────────────────
84+
# Library Targets
85+
# ──────────────────────────────────────────────
86+
87+
# Core
88+
add_library(eo_core STATIC
89+
src/core/logger.cpp
90+
src/core/config.cpp
91+
)
92+
target_include_directories(eo_core PUBLIC src)
93+
target_link_libraries(eo_core PUBLIC nlohmann_json::nlohmann_json tomlplusplus::tomlplusplus)
94+
95+
# Resource Monitor
96+
add_library(eo_resource_monitor STATIC
97+
src/resource_monitor/linux_monitor.cpp
98+
src/resource_monitor/mock_monitor.cpp
99+
)
100+
target_include_directories(eo_resource_monitor PUBLIC src)
101+
target_link_libraries(eo_resource_monitor PUBLIC eo_core)
102+
103+
# Workload
104+
add_library(eo_workload STATIC
105+
src/workload/dag.cpp
106+
src/workload/generator.cpp
107+
)
108+
target_include_directories(eo_workload PUBLIC src)
109+
target_link_libraries(eo_workload PUBLIC eo_core)
110+
111+
# Scheduler
112+
add_library(eo_scheduler STATIC
113+
src/scheduler/greedy_policy.cpp
114+
src/scheduler/threshold_policy.cpp
115+
src/scheduler/optimizer_policy.cpp
116+
src/scheduler/cluster_view.cpp
117+
)
118+
target_include_directories(eo_scheduler PUBLIC src)
119+
target_link_libraries(eo_scheduler PUBLIC eo_core eo_workload)
120+
121+
# Executor
122+
add_library(eo_executor STATIC
123+
src/executor/thread_pool.cpp
124+
src/executor/task_runner.cpp
125+
src/executor/memory_pool.cpp
126+
)
127+
target_include_directories(eo_executor PUBLIC src)
128+
target_link_libraries(eo_executor PUBLIC eo_core)
129+
130+
# Network
131+
add_library(eo_network STATIC
132+
src/network/peer_discovery.cpp
133+
src/network/transport.cpp
134+
src/network/cluster_view.cpp
135+
${PROTO_SRCS}
136+
)
137+
target_include_directories(eo_network PUBLIC src ${CMAKE_CURRENT_BINARY_DIR})
138+
target_link_libraries(eo_network PUBLIC eo_core protobuf::libprotobuf)
139+
140+
# Telemetry
141+
add_library(eo_telemetry STATIC
142+
src/telemetry/metrics_collector.cpp
143+
src/telemetry/json_sink.cpp
144+
)
145+
target_include_directories(eo_telemetry PUBLIC src)
146+
target_link_libraries(eo_telemetry PUBLIC eo_core nlohmann_json::nlohmann_json)
147+
148+
# Orchestrator (facade — depends on all other modules)
149+
add_library(eo_orchestrator STATIC
150+
src/orchestrator/offload_codec.cpp
151+
)
152+
target_include_directories(eo_orchestrator PUBLIC src)
153+
target_link_libraries(eo_orchestrator PUBLIC
154+
eo_core eo_resource_monitor eo_workload eo_scheduler
155+
eo_executor eo_network eo_telemetry
156+
)
157+
158+
# ──────────────────────────────────────────────
159+
# Main Daemon Executable
160+
# ──────────────────────────────────────────────
161+
add_executable(edge_orchestrator src/app/main.cpp)
162+
target_link_libraries(edge_orchestrator PRIVATE
163+
eo_orchestrator
164+
eo_core
165+
eo_resource_monitor
166+
eo_workload
167+
eo_scheduler
168+
eo_executor
169+
eo_network
170+
eo_telemetry
171+
pthread
172+
)
173+
174+
# ──────────────────────────────────────────────
175+
# Tests
176+
# ──────────────────────────────────────────────
177+
if(BUILD_TESTS)
178+
add_subdirectory(tests)
179+
endif()
180+
181+
# ──────────────────────────────────────────────
182+
# Install
183+
# ──────────────────────────────────────────────
184+
install(TARGETS edge_orchestrator DESTINATION bin)
185+
install(FILES config/default.toml DESTINATION etc/edge_orchestrator)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025-2026 Dimitris Kafetzis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)