Skip to content

Commit

Permalink
Add Continuous Integration (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Jun 29, 2023
1 parent aa83c3a commit 881b5b5
Show file tree
Hide file tree
Showing 5 changed files with 3,065 additions and 4,411 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: C++ CI Workflow

on:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

jobs:
build:
name: '[${{ matrix.os }}@conda]'
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_type: [Release]
os: [ubuntu-latest, windows-2019, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: Install pixi [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
curl -fsSL https://github.com/raw/prefix-dev/pixi/main/install/install.sh | bash
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
- name: Install pixi [Windows]
if: contains(matrix.os, 'windows')
shell: pwsh
run: |
iwr -useb https://github.com/raw/prefix-dev/pixi/main/install/install.ps1 | iex
"$env:LOCALAPPDATA\pixi\bin" >> $env:GITHUB_PATH
- name: Build
shell: bash -l {0}
run: |
# As of pixi 0.0.5 the dependency does not work nicely
pixi run build
- name: Run
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
run: |
# pixi run onnx-cpp-benchmark --help
# manually running onnx-cpp-benchmark as a workaround for https://github.com/prefix-dev/pixi/issues/157
./.build/onnx-cpp-benchmark --help
# Workaround for https://github.com/prefix-dev/pixi/issues/157
- name: Setup for Run
if: contains(matrix.os, 'windows')
run: |
"D:\a\onnx-cpp-benchmark\onnx-cpp-benchmark\.pixi\env\Library\bin" >> $env:GITHUB_PATH
- name: Run
if: contains(matrix.os, 'windows')
run: |
cd .build
.\onnx-cpp-benchmark --help
34 changes: 34 additions & 0 deletions cmake/Findonnxruntime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2023 Giulio Romualdi
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
Findonnxruntime
-----------

The following imported targets are created:

onnxruntime::onnxruntime

#]=======================================================================]

include(FindPackageHandleStandardArgs)

find_path(onnxruntime_INCLUDE_DIR
NAMES onnxruntime_cxx_api.h
PATH_SUFFIXES onnxruntime/core/session)
mark_as_advanced(onnxruntime_INCLUDE_DIR)
find_library(onnxruntime_LIBRARY
NAMES onnxruntime onnxruntime_conda)
mark_as_advanced(onnxruntime_LIBRARY)

find_package_handle_standard_args(onnxruntime DEFAULT_MSG onnxruntime_INCLUDE_DIR onnxruntime_LIBRARY)

if(onnxruntime_FOUND)
if(NOT TARGET onnxruntime::onnxruntime)
add_library(onnxruntime::onnxruntime UNKNOWN IMPORTED)
set_target_properties(onnxruntime::onnxruntime PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${onnxruntime_INCLUDE_DIR}")
set_property(TARGET onnxruntime::onnxruntime PROPERTY
IMPORTED_LOCATION "${onnxruntime_LIBRARY}")
endif()
endif()
4 changes: 2 additions & 2 deletions onnx-cpp-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int main(int argc, char* argv[])
CLI::App app{"onnx-cpp-benchmark: Simple tool to profile onnx inference with C++ APis."};

// Read the parameters from the command line arguments
std::string onnxfilepath = argv[1];
std::string onnxfilepath;

// Number of inputs fed to the network fed to the network in one inference run
int64_t nrOfParallelInputsInOneIteration = 10;
Expand Down Expand Up @@ -388,4 +388,4 @@ int main(int argc, char* argv[])
}

return 0;
}
}
Loading

0 comments on commit 881b5b5

Please sign in to comment.