Initial commit as Claude developed it
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 22s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m44s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 6m12s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m13s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 5m30s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Docker Build Test (push) Failing after 13s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Successful in 31s
CI/CD Pipeline / Create Release Package (push) Has been skipped
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 22s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m44s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 6m12s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m13s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 5m30s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Docker Build Test (push) Failing after 13s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Successful in 31s
CI/CD Pipeline / Create Release Package (push) Has been skipped
This commit is contained in:
96
.github/workflows/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
96
.github/workflows/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: '[BUG] '
|
||||
labels: ['bug', 'needs-triage']
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## 🐛 Bug Description
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## 🔄 Steps to Reproduce
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## ✅ Expected Behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## ❌ Actual Behavior
|
||||
|
||||
A clear and concise description of what actually happened.
|
||||
|
||||
## 💻 Environment
|
||||
|
||||
**System Information:**
|
||||
- OS: [e.g. Ubuntu 20.04, macOS 12.0, Windows 10]
|
||||
- Compiler: [e.g. GCC 9.4.0, Clang 12.0.0, MSVC 2019]
|
||||
- CMake Version: [e.g. 3.20.0]
|
||||
- PyTorch Version: [e.g. 2.1.0]
|
||||
|
||||
**Library Versions:**
|
||||
- SVM Classifier Version: [e.g. 1.0.0]
|
||||
- libsvm Version: [if known]
|
||||
- liblinear Version: [if known]
|
||||
|
||||
## 📋 Minimal Reproduction Code
|
||||
|
||||
```cpp
|
||||
#include <svm_classifier/svm_classifier.hpp>
|
||||
#include <torch/torch.h>
|
||||
|
||||
int main() {
|
||||
// Your minimal code that reproduces the issue
|
||||
using namespace svm_classifier;
|
||||
|
||||
// Example:
|
||||
auto X = torch::randn({100, 4});
|
||||
auto y = torch::randint(0, 3, {100});
|
||||
|
||||
SVMClassifier svm(KernelType::RBF);
|
||||
auto metrics = svm.fit(X, y); // Error occurs here
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
**Compilation command:**
|
||||
```bash
|
||||
g++ -std=c++17 reproduce_bug.cpp -lsvm_classifier -ltorch -ltorch_cpu -o reproduce_bug
|
||||
```
|
||||
|
||||
## 📊 Error Output
|
||||
|
||||
```
|
||||
Paste the full error message, stack trace, or unexpected output here
|
||||
```
|
||||
|
||||
## 🔍 Additional Context
|
||||
|
||||
Add any other context about the problem here:
|
||||
|
||||
- Were you following a specific tutorial or documentation?
|
||||
- Did this work in a previous version?
|
||||
- Are there any workarounds you've found?
|
||||
- Any additional error logs or debugging information?
|
||||
|
||||
## 📎 Attachments
|
||||
|
||||
If applicable, add:
|
||||
- Screenshots of error messages
|
||||
- Log files
|
||||
- Core dumps (if available)
|
||||
- Example datasets (if relevant and small)
|
||||
|
||||
## ✅ Checklist
|
||||
|
||||
- [ ] I have searched for existing issues that might be related to this bug
|
||||
- [ ] I have provided a minimal reproduction case
|
||||
- [ ] I have included all relevant environment information
|
||||
- [ ] I have tested this with the latest version of the library
|
||||
- [ ] I have checked that my build environment meets the requirements
|
165
.github/workflows/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
165
.github/workflows/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: '[FEATURE] '
|
||||
labels: ['enhancement', 'needs-triage']
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## 🚀 Feature Description
|
||||
|
||||
A clear and concise description of the feature you'd like to see implemented.
|
||||
|
||||
## 💡 Motivation
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Why would this feature be valuable?**
|
||||
- Improves performance for [specific use case]
|
||||
- Adds functionality that is missing for [specific scenario]
|
||||
- Makes the API more consistent with [reference implementation]
|
||||
- Enables new applications in [domain/field]
|
||||
|
||||
## 🎯 Proposed Solution
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**API Design (if applicable)**
|
||||
```cpp
|
||||
// Example of how you envision the API would look
|
||||
class SVMClassifier {
|
||||
public:
|
||||
// Proposed new method
|
||||
NewFeatureResult new_feature_method(const torch::Tensor& input,
|
||||
const FeatureParameters& params);
|
||||
|
||||
// Or modifications to existing methods
|
||||
TrainingMetrics fit(const torch::Tensor& X,
|
||||
const torch::Tensor& y,
|
||||
const NewOptions& options = {});
|
||||
};
|
||||
```
|
||||
|
||||
## 🔄 Alternatives Considered
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
- Alternative implementation approaches
|
||||
- Workarounds you've tried
|
||||
- Other libraries that provide similar functionality
|
||||
- Why those alternatives are not sufficient
|
||||
|
||||
## 📚 Examples and Use Cases
|
||||
|
||||
**Provide concrete examples of how this feature would be used:**
|
||||
|
||||
### Example 1: [Use Case Name]
|
||||
```cpp
|
||||
// Example code showing how the feature would be used
|
||||
SVMClassifier svm;
|
||||
auto result = svm.new_feature_method(data, params);
|
||||
// Expected behavior and benefits
|
||||
```
|
||||
|
||||
### Example 2: [Another Use Case]
|
||||
```cpp
|
||||
// Another example showing different usage
|
||||
```
|
||||
|
||||
## 🔧 Implementation Considerations
|
||||
|
||||
**Technical details (if you have insights):**
|
||||
- [ ] This would require changes to the core API
|
||||
- [ ] This would add new dependencies
|
||||
- [ ] This would affect performance
|
||||
- [ ] This would require additional testing
|
||||
- [ ] This would need documentation updates
|
||||
|
||||
**Potential challenges:**
|
||||
- Dependencies on external libraries
|
||||
- Compatibility with existing API
|
||||
- Performance implications
|
||||
- Memory usage considerations
|
||||
- Cross-platform support
|
||||
|
||||
**Rough implementation approach:**
|
||||
- Brief description of how this could be implemented
|
||||
- Which components would need to be modified
|
||||
- Any external dependencies required
|
||||
|
||||
## 📊 Expected Impact
|
||||
|
||||
**Performance:**
|
||||
- Expected performance improvements/implications
|
||||
- Memory usage changes
|
||||
- Training/prediction time impact
|
||||
|
||||
**Compatibility:**
|
||||
- [ ] This is a breaking change
|
||||
- [ ] This is backward compatible
|
||||
- [ ] This affects the public API
|
||||
- [ ] This only affects internal implementation
|
||||
|
||||
**Users:**
|
||||
- Who would benefit from this feature?
|
||||
- How common is this use case?
|
||||
- What's the expected adoption rate?
|
||||
|
||||
## 🌍 Related Work
|
||||
|
||||
**References to similar functionality:**
|
||||
- Links to papers, documentation, or implementations
|
||||
- How other libraries handle this feature
|
||||
- Standards or best practices that should be followed
|
||||
|
||||
**Prior art:**
|
||||
- scikit-learn: [link to relevant functionality]
|
||||
- Other C++ ML libraries: [examples]
|
||||
- Research papers: [citations]
|
||||
|
||||
## ⏰ Priority and Timeline
|
||||
|
||||
**Priority level:**
|
||||
- [ ] High - Critical functionality that's blocking important use cases
|
||||
- [ ] Medium - Useful feature that would improve the library
|
||||
- [ ] Low - Nice-to-have enhancement
|
||||
|
||||
**Timeline expectations:**
|
||||
- When would you ideally like to see this implemented?
|
||||
- Are there any deadlines or external factors driving this request?
|
||||
|
||||
## 🤝 Contribution
|
||||
|
||||
**Are you willing to contribute to implementing this feature?**
|
||||
- [ ] Yes, I can implement this feature
|
||||
- [ ] Yes, I can help with testing and review
|
||||
- [ ] Yes, I can help with documentation
|
||||
- [ ] I can provide guidance but cannot implement
|
||||
- [ ] I cannot contribute but would like to see this implemented
|
||||
|
||||
**Your experience level:**
|
||||
- [ ] Expert in C++ and machine learning
|
||||
- [ ] Experienced with C++ or machine learning
|
||||
- [ ] Intermediate programmer
|
||||
- [ ] Beginner but eager to learn
|
||||
|
||||
## 📋 Additional Context
|
||||
|
||||
Add any other context, screenshots, diagrams, or examples about the feature request here.
|
||||
|
||||
**Related issues:**
|
||||
- Links to related issues or discussions
|
||||
- Dependencies on other features
|
||||
|
||||
**Documentation:**
|
||||
- What documentation would need to be updated?
|
||||
- What examples should be added?
|
||||
|
||||
## ✅ Checklist
|
||||
|
||||
- [ ] I have searched for existing feature requests that might be similar
|
||||
- [ ] I have provided clear motivation for why this feature is needed
|
||||
- [ ] I have considered the implementation complexity and compatibility
|
||||
- [ ] I have provided concrete examples of how this would be used
|
||||
- [ ] I have indicated my willingness to contribute to the implementation
|
258
.github/workflows/ci.yml
vendored
Normal file
258
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Code Linting
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install clang-format
|
||||
run: sudo apt-get update && sudo apt-get install -y clang-format
|
||||
|
||||
- name: Check code formatting
|
||||
run: |
|
||||
find src include tests examples -name "*.cpp" -o -name "*.hpp" | \
|
||||
xargs clang-format --dry-run --Werror
|
||||
|
||||
build-and-test:
|
||||
name: Build and Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, ubuntu-20.04]
|
||||
build_type: [Release, Debug]
|
||||
compiler: [gcc, clang]
|
||||
exclude:
|
||||
# Reduce matrix size for faster CI
|
||||
- os: ubuntu-20.04
|
||||
build_type: Debug
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
build/_deps
|
||||
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
${{ matrix.os }}-${{ matrix.compiler }}-
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
pkg-config \
|
||||
libblas-dev \
|
||||
liblapack-dev \
|
||||
valgrind \
|
||||
lcov
|
||||
|
||||
- name: Setup Clang
|
||||
if: matrix.compiler == 'clang'
|
||||
run: |
|
||||
sudo apt-get install -y clang-12
|
||||
echo "CC=clang-12" >> $GITHUB_ENV
|
||||
echo "CXX=clang++-12" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup GCC
|
||||
if: matrix.compiler == 'gcc'
|
||||
run: |
|
||||
echo "CC=gcc" >> $GITHUB_ENV
|
||||
echo "CXX=g++" >> $GITHUB_ENV
|
||||
|
||||
- name: Install PyTorch C++
|
||||
run: |
|
||||
cd /opt
|
||||
sudo wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcpu.zip
|
||||
sudo unzip -q libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
sudo rm libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
echo "Torch_DIR=/opt/libtorch" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
|
||||
-DCMAKE_PREFIX_PATH=/opt/libtorch \
|
||||
-DCMAKE_CXX_COMPILER=${{ env.CXX }} \
|
||||
-DCMAKE_C_COMPILER=${{ env.CC }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config ${{ matrix.build_type }} -j$(nproc)
|
||||
|
||||
- name: Run Tests
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
ctest --output-on-failure --timeout 300
|
||||
|
||||
- name: Run Unit Tests
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
make test_unit
|
||||
|
||||
- name: Run Integration Tests
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
make test_integration
|
||||
|
||||
- name: Generate Coverage Report
|
||||
if: matrix.build_type == 'Debug' && matrix.compiler == 'gcc'
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
make coverage
|
||||
|
||||
- name: Upload Coverage to Codecov
|
||||
if: matrix.build_type == 'Debug' && matrix.compiler == 'gcc'
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: build/coverage_filtered.info
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Memory Check with Valgrind
|
||||
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
make test_memcheck
|
||||
|
||||
- name: Run Examples
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
./examples/basic_usage
|
||||
|
||||
docker-build:
|
||||
name: Docker Build Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t svm-classifier:test --target runtime .
|
||||
|
||||
- name: Test Docker Image
|
||||
run: |
|
||||
docker run --rm svm-classifier:test /usr/local/bin/examples/basic_usage
|
||||
|
||||
performance-benchmark:
|
||||
name: Performance Benchmarks
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential cmake pkg-config libblas-dev liblapack-dev
|
||||
|
||||
- name: Install PyTorch C++
|
||||
run: |
|
||||
cd /opt
|
||||
sudo wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcpu.zip
|
||||
sudo unzip -q libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
sudo rm libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
|
||||
- name: Build with benchmarks
|
||||
run: |
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/libtorch
|
||||
cmake --build build -j$(nproc)
|
||||
|
||||
- name: Run Performance Tests
|
||||
working-directory: build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH
|
||||
make test_performance
|
||||
|
||||
documentation:
|
||||
name: Build Documentation
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Doxygen
|
||||
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
|
||||
|
||||
- name: Generate Documentation
|
||||
run: |
|
||||
doxygen Doxyfile
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/html
|
||||
|
||||
package:
|
||||
name: Create Release Package
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-and-test, docker-build]
|
||||
if: github.event_name == 'release'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential cmake pkg-config libblas-dev liblapack-dev
|
||||
|
||||
- name: Install PyTorch C++
|
||||
run: |
|
||||
cd /opt
|
||||
sudo wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcpu.zip
|
||||
sudo unzip -q libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
sudo rm libtorch-cxx11-abi-shared-with-deps-2.1.0+cpu.zip
|
||||
|
||||
- name: Build Release Package
|
||||
run: |
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/libtorch
|
||||
cmake --build build -j$(nproc)
|
||||
cd build && cpack
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./build/SVMClassifier-*.tar.gz
|
||||
asset_name: svm-classifier-${{ github.event.release.tag_name }}-linux.tar.gz
|
||||
asset_content_type: application/gzip
|
Reference in New Issue
Block a user