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
31 changes: 21 additions & 10 deletions .github/workflows/agent_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,53 @@ on:
push:
branches: [ "main", "devel" ]
paths:
- 'source/agent/**' # If changes are in the agent source code
- 'libs/**' # If changes are in libraries (proto, NVIDIA headers)
- 'CMakeLists.txt' # If changes are in main CMake (affects everything)
- 'source/agent/**'
- 'libs/**'
- 'CMakeLists.txt'
- 'vcpkg.json'
- 'CMakePresets.json'
- '.github/workflows/agent_ci.yml'
pull_request:
branches: [ "main", "devel" ]
paths:
- 'source/agent/**'
- 'libs/**'
- 'CMakeLists.txt'
- 'vcpkg.json'
- 'CMakePresets.json'
- '.github/workflows/agent_ci.yml'

jobs:
build-and-test:
name: Build & Format Check
runs-on: ubuntu-latest

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

steps:
- uses: actions/checkout@v4

- name: Install dependencies

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake \
libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc \
libabsl-dev clang-format cppcheck
sudo apt-get install -y build-essential cmake clang-format cppcheck

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'

- name: Check Code Formatting
run: |
find source/agent -name "*.cc" -o -name "*.h" | xargs clang-format --dry-run --Werror -style=Google

- name: CMake Configure
run: cmake -B build -S .
run: cmake --preset default

- name: Build
run: cmake --build build --parallel $(nproc)
run: cmake --build --preset default

- name: Analyze Logic
run: |
Expand All @@ -48,5 +59,5 @@ jobs:
--suppress=missingIncludeSystem \
--inline-suppr \
--force \
-i build -i libs \
-i build \
source/agent
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_package(Protobuf REQUIRED)
find_package(protobuf CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)

set(PROTO_DIR ${CMAKE_SOURCE_DIR}/libs/proto)
set(PROTO_FILE ${PROTO_DIR}/volta.proto)
Expand Down Expand Up @@ -39,7 +40,13 @@ add_library(volta_proto ${PROTO_SRC} ${PROTO_HDR} ${GRPC_SRC} ${GRPC_HDR})

target_include_directories(volta_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries(volta_proto PRIVATE protobuf::libprotobuf gRPC::grpc++)
target_link_libraries(volta_proto PRIVATE
protobuf::libprotobuf
gRPC::grpc++
gRPC::grpc++_reflection
fmt::fmt
${CMAKE_DL_LIBS}
)

include_directories("${LOCAL_INCLUDE_DIR}/nvidia")

Expand Down
19 changes: 19 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default"
}
]
}
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# volta
# volta


## Development Setup

Project is using CMake as build system and vcpkg in Manifest Mode for dependency management.

### 1. Initial Requirements

- **Linux** (Kernel 5.x.+)
- **C++20 Compiler** (GCC 11+/Clang 14+)
- **CMake** (3.16+)
- **Git**

### 2. Vcpkg Installation

```bash
# Clone vcpkg repository
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg

# Run bootstraping script
~/vcpkg/bootstrap-vcpkg.sh

# (Optional) Set VCPKG_ROOT environment variable in .bashrc (or other rc)
# Otherway you will need to enter the path for every single build.
export VCPKG_ROOT=~/vcpkg
```

### 3. Build Project

```bash
# Configurate the project, compile dependencies.
# If VCPKG_ROOT was not set, point toolchain yourself using
# -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake -B build -S .

# Compilation
cmake --build build
```

### 4. Run Agent

```bash
# May require root/admin privileges to access RAPL/Affinity features.
./build/source/agent/volta_agent
```

### FAQ
**Q: Do I have to enter `vcpkg install`?**
**A:** No, project is working in Manifest Mode. CMake automatically reads the `vcpkg.json` file and installs whats needed in isolated environment inside build directory.

**Q: I changed `vcpkg.json`, but build see no difference.**
**A:** Clean up CMake cache, and build project once again:
```bash
rm -rf build
cmake -B build -S .
```
10 changes: 10 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "volta-agent",
"version-string": "0.1.0",
"builtin-baseline": "6d7bf7ef2193e2d1c5798a5ff8811d533104c861",
"dependencies": [
"fmt",
"grpc",
"protobuf"
]
}