Skip to content

Commit

Permalink
Merge branch 'dev' into feat/installer-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hientominh committed Sep 11, 2024
2 parents 5a06780 + 4cc7528 commit 2815191
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
new_version: ${{ needs.get-update-version.outputs.new_version }}
runs-on: macos-12
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
channel: nightly
arch: amd64

Expand All @@ -65,7 +65,7 @@ jobs:
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
new_version: ${{ needs.get-update-version.outputs.new_version }}
runs-on: macos-latest
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
channel: nightly
arch: arm64

Expand All @@ -78,7 +78,7 @@ jobs:
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
new_version: ${{ needs.get-update-version.outputs.new_version }}
runs-on: windows-cuda-11-7
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
channel: nightly
Expand All @@ -92,7 +92,7 @@ jobs:
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
new_version: ${{ needs.get-update-version.outputs.new_version }}
runs-on: ubuntu-20-04
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
channel: nightly

update-latest-version:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/template-build-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ jobs:
if: inputs.public_provider == 'aws-s3'
run: |
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/linux-amd64/cortex-nightly.tar.gz
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/linux-amd64/cortex-linux-amd64-installer-${{ inputs.new_version }}.deb
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/linux-amd64/cortex-nightly.tar.gz
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/linux-amd64/cortex-nightly-${{ inputs.new_version }}.tar.gz
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/linux-amd64/cortex-linux-amd64-installer-${{ inputs.new_version }}.deb
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/template-build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ jobs:
if: inputs.public_provider == 'aws-s3'
run: |
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-${{ inputs.arch}}/cortex-nightly.tar.gz
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.pkg s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-${{ inputs.arch}}/cortex-mac-${{ inputs.arch}}-installer-${{ inputs.new_version }}.pkg
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/mac-${{ inputs.arch}}/cortex-nightly.tar.gz
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/mac-${{ inputs.arch}}/cortex-nightly-${{ inputs.new_version }}.tar.gz
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.pkg s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/mac-${{ inputs.arch}}/cortex-mac-${{ inputs.arch}}-installer-${{ inputs.new_version }}.pkg
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/template-build-windows-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,26 @@ jobs:
make build-installer PACKAGE_NAME=${{ steps.set-output-params.outputs.package_name }} VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}"
ls ../
- name: Enable long paths
run: |
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/[email protected]
uses: nadeemjazmawe/[email protected]
with:
path: ${{ steps.set-output-params.outputs.iss_file_name }}
options: /O+
filepath: ./${{ steps.set-output-params.outputs.iss_file_name }}

- name: Codesign for windows installer
shell: pwsh
run: |
%USERPROFILE%\.dotnet\tools\azuresigntool.exe sign -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvi ${{ secrets.AZURE_CLIENT_ID }} -kvt ${{ secrets.AZURE_TENANT_ID }} -kvs ${{ secrets.AZURE_CLIENT_SECRET }} -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\setup.exe";'
~\.dotnet\tools\azuresigntool.exe sign -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvi ${{ secrets.AZURE_CLIENT_ID }} -kvt ${{ secrets.AZURE_TENANT_ID }} -kvs ${{ secrets.AZURE_CLIENT_SECRET }} -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\setup.exe"
- name: Package
run: |
cd engine
make package
- name: Upload Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cortex-${{ inputs.new_version }}-windows-amd64
Expand All @@ -212,10 +216,11 @@ jobs:
- name: upload to aws s3 if public provider is aws
if: inputs.public_provider == 'aws-s3'
run: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/windows-amd64/cortex-nightly.tar.gz
aws s3 cp ./setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/windows-amd64/cortex-nightly.tar.gz
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/windows-amd64/cortex-nightly-${{ inputs.new_version }}.tar.gz
aws s3 cp ./setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
Expand Down
7 changes: 3 additions & 4 deletions engine/commands/engine_get_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ void EngineGetCmd::Exec() const {
try {
auto status = engine_service.GetEngineInfo(engine_);
tabulate::Table table;
table.add_row({"name", "description", "version", "product name", "status"});
table.format().font_color(tabulate::Color::green);
table.add_row({status.name, status.description, status.version,
status.product_name, status.status});
table.add_row({"Name", "Supported Formats", "Version", "Status"});
table.add_row(
{status.product_name, status.format, status.version, status.status});
std::cout << table << std::endl;
} catch (const std::runtime_error& e) {
std::cerr << "Engine " << engine_ << " is not supported!" << "\n";
Expand Down
22 changes: 3 additions & 19 deletions engine/commands/engine_list_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,12 @@ bool EngineListCmd::Exec() {
auto status_list = engine_service.GetEngineInfoList();

tabulate::Table table;
table.format().font_color(tabulate::Color::green);
table.add_row(
{"(Index)", "name", "description", "version", "product name", "status"});
table.add_row({"#", "Name", "Supported Formats", "Version", "Status"});
for (int i = 0; i < status_list.size(); i++) {
auto status = status_list[i];
std::string index = std::to_string(i + 1);
table.add_row({index, status.name, status.description, status.version,
status.product_name, status.status});
}

for (int i = 0; i < 6; i++) {
table[0][i]
.format()
.font_color(tabulate::Color::white) // Set font color
.font_style({tabulate::FontStyle::bold})
.font_align(tabulate::FontAlign::center);
}
for (int i = 1; i < 4; i++) {
table[i][0]
.format()
.font_color(tabulate::Color::white) // Set font color
.font_align(tabulate::FontAlign::center);
table.add_row({index, status.product_name, status.format, status.version,
status.status});
}

std::cout << table << std::endl;
Expand Down
37 changes: 22 additions & 15 deletions engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#include "algorithm"
#include "utils/file_manager_utils.h"

namespace {
constexpr static auto kIncompatible = "Incompatible";
constexpr static auto kReady = "Ready";
constexpr static auto kNotInstalled = "Not Installed";
} // namespace

EngineInfo EngineService::GetEngineInfo(const std::string& engine) const {
// if engine is not found in kSupportEngine, throw runtime error
if (std::find(kSupportEngines.begin(), kSupportEngines.end(), engine) ==
Expand All @@ -21,42 +27,43 @@ EngineInfo EngineService::GetEngineInfo(const std::string& engine) const {
std::vector<EngineInfo> EngineService::GetEngineInfoList() const {
auto ecp = file_manager_utils::GetEnginesContainerPath();

std::string onnx_status{"not_supported"};
std::string llamacpp_status = std::filesystem::exists(ecp / "cortex.llamacpp")
? "ready"
: "not_initialized";
std::string tensorrt_status{"not_supported"};
std::string onnx_status{kIncompatible};
std::string llamacpp_status =
std::filesystem::exists(ecp / "cortex.llamacpp") ? kReady : kNotInstalled;
std::string tensorrt_status{kIncompatible};

#ifdef _WIN32
onnx_status = std::filesystem::exists(ecp / "cortex.onnx")
? "ready"
: "not_initialized";
onnx_status =
std::filesystem::exists(ecp / "cortex.onnx") ? kReady : kNotInstalled;
tensorrt_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm")
? "ready"
: "not_initialized";
? kReady
: kNotInstalled;
#elif defined(__linux__)
tensorrt_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm")
? "ready"
: "not_initialized";
? kReady
: kNotInstalled;
#endif
std::vector<EngineInfo> engines = {
{.name = "cortex.onnx",
.description = "This extension enables chat completion API calls using "
"the Onnx engine",
.format = "ONNX",
.version = "0.0.1",
.product_name = "Onnx Inference Engine",
.product_name = "ONNXRuntime",
.status = onnx_status},
{.name = "cortex.llamacpp",
.description = "This extension enables chat completion API calls using "
"the LlamaCPP engine",
.format = "GGUF",
.version = "0.0.1",
.product_name = "LlamaCPP Inference Engine",
.product_name = "llama.cpp",
.status = llamacpp_status},
{.name = "cortex.tensorrt-llm",
.description = "This extension enables chat completion API calls using "
"the TensorrtLLM engine",
.format = "TensorRT Engines",
.version = "0.0.1",
.product_name = "TensorrtLLM Inference Engine",
.product_name = "TensorRT-LLM",
.status = tensorrt_status},
};

Expand Down
1 change: 1 addition & 0 deletions engine/services/engine_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
struct EngineInfo {
std::string name;
std::string description;
std::string format;
std::string version;
std::string product_name;
std::string status;
Expand Down

0 comments on commit 2815191

Please sign in to comment.