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
14 changes: 1 addition & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

env:
VCPKG_COMMIT_SHA: 56bb2411609227288b70117ead2c47585ba07713 # corresponds to tag 2026.04.27
VCPKG_COMMIT_SHA: 94a541197763a4f449a1b91478df48c0584a6256 # from 2026.08.15

# for matrix check https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners
jobs:
Expand Down Expand Up @@ -58,17 +58,6 @@ jobs:
with:
python-version: "3.13"

- name: Start ssh key agent
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}

- name: Install SSH deploy key for rulessupport
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
known_hosts: github.com AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==

- name: Set vcpkg environment (Unix)
if: "!startsWith(runner.os, 'Windows')"
run: |
Expand Down Expand Up @@ -117,7 +106,6 @@ jobs:
conan-user: ${{secrets.LKEB_UPLOAD_USER}}
conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}}
conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}}
rs_ssh_key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}

- name: Linux build
if: startsWith(matrix.os, 'ubuntu')
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endif()
# ExamplePlugins
# -----------------------------------------------------------------------------
set(PROJECT "ExamplePlugins")
PROJECT(${PROJECT} C CXX)
PROJECT(${PROJECT} LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
12 changes: 3 additions & 9 deletions ExampleDependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ set_target_properties(hwy_list_targets PROPERTIES EXCLUDE_FROM_ALL True)

if(${MV_EXAMPLES_USE_VCPKG})
find_package(blake3 CONFIG REQUIRED)

if(NOT APPLE)
include(cmake/ci_fixes.cmake)
find_package(faiss CONFIG REQUIRED)
endif()
find_package(OpenMP REQUIRED)
find_package(faiss CONFIG REQUIRED)
endif()

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -106,12 +103,9 @@ target_link_libraries(${PROJECT_NAME} PRIVATE hwy hwy_contrib)

if(${MV_EXAMPLES_USE_VCPKG})
target_link_libraries(${PROJECT_NAME} PRIVATE BLAKE3::blake3)

if(NOT APPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE faiss)
endif()

target_compile_definitions (${PROJECT_NAME} PRIVATE __USE_VCPKG__)
target_compile_definitions (${PROJECT_NAME} PRIVATE __MV_EXAMPLES_USE_VCPKG__)
endif()

# Not used here, but you can use this in your plugin
Expand Down
38 changes: 16 additions & 22 deletions ExampleDependencies/src/ExampleDependenciesPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@

#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <vector>

#include <hwy/contrib/sort/order.h>
#include <hwy/contrib/sort/vqsort.h>

#if defined __USE_VCPKG__
#ifdef __MV_EXAMPLES_USE_VCPKG__
#include <blake3.h>

#if !defined(__APPLE__)
#include <faiss/IndexFlat.h>
using idx_t = faiss::idx_t;
#endif
#endif

Q_PLUGIN_METADATA(IID "studio.manivault.ExampleDependenciesPlugin")
Expand Down Expand Up @@ -58,21 +54,21 @@ void ExampleDependenciesPlugin::init()

void ExampleDependenciesPlugin::compute()
{
std::cout << "ExampleDependenciesPlugin: Starting..." << std::endl;
std::cout << "ExampleDependenciesPlugin: Starting.../n" << std::endl;

auto printData = [](const std::vector<float>& vec, size_t dims, size_t points) {
for (size_t dim = 0; dim < dims; dim++)
auto printData = [](const std::vector<float>& vec, const int64_t dims, const int64_t points) {
for (int64_t dim = 0; dim < dims; dim++)
{
for (size_t point = 0; point < points; point++)
for (int64_t point = 0; point < points; point++)
std::cout << vec[point + points * dim] << " ";
std::cout << std::endl;
}
};

// Get input data
const auto inputPoints = getInputDataset<Points>();
const size_t numDims = inputPoints->getNumDimensions();
const size_t numPoints = inputPoints->getNumPoints();
const auto numDims = static_cast<int64_t>(inputPoints->getNumDimensions());
const auto numPoints = static_cast<int64_t>(inputPoints->getNumPoints());

std::vector<float> data;
std::vector<unsigned int> dimensionIndices(numDims);
Expand All @@ -84,9 +80,9 @@ void ExampleDependenciesPlugin::compute()
std::cout << "ExampleDependenciesPlugin: Data before sorting" << std::endl;
printData(data, numDims, numPoints);

for (size_t dim = 0; dim < numDims; dim++)
for (int64_t dim = 0; dim < numDims; dim++)
{
size_t offset = numPoints * dim;
int64_t offset = numPoints * dim;
hwy::VQSort(data.data() + offset, numPoints, hwy::SortAscending{});
}

Expand All @@ -98,7 +94,7 @@ void ExampleDependenciesPlugin::compute()
outputPoints->setData(data.data(), numPoints, numDims);
events().notifyDatasetDataChanged(outputPoints);

#if defined __USE_VCPKG__
#ifdef __MV_EXAMPLES_USE_VCPKG__
std::cout << "ExampleDependenciesPlugin: Using blake version: " << blake3_version() << std::endl;

// Create hash
Expand All @@ -116,25 +112,23 @@ void ExampleDependenciesPlugin::compute()
}
printf("\n");

#if !defined(__APPLE__)
// find knn
faiss::IndexFlatL2 index(numDims); // call constructor
index.add(numPoints, data.data()); // add vectors to the index

int k = std::max(static_cast<size_t>(5), numPoints);
std::vector<idx_t> I(k * numPoints);
const int64_t k = std::max(static_cast<int64_t>(5), numPoints);
std::vector<int64_t> I(k * numPoints);
std::vector<float> D(k * numPoints);

index.search(numPoints, data.data(), k, D.data(), I.data());

printf("knn results\n");
for (size_t i = 0; i < numPoints; i++) {
for (int j = 0; j < k; j++)
for (int64_t i = 0; i < numPoints; i++) {
for (int64_t j = 0; j < k; j++)
printf("%5zd ", I[i * k + j]);
printf("\n");
}
#endif // __APPLE__
#endif // __USE_VCPKG__
#endif // __MV_EXAMPLES_USE_VCPKG__

std::cout << "ExampleDependenciesPlugin: Finished." << std::endl;
}
Expand Down
19 changes: 15 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conans import ConanFile
from conan.tools.cmake import CMakeDeps, CMake, CMakeToolchain
from conans.tools import save, load
from conans.tools import save, load, os_info, SystemPackageTool
import os
import pathlib
import subprocess
Expand Down Expand Up @@ -70,8 +70,11 @@ def configure(self):
pass

def system_requirements(self):
# May be needed for macOS or Linux
pass
if os_info.is_macos:
installer = SystemPackageTool()
installer.install("libomp")
proc = subprocess.run("brew --prefix libomp", shell=True, capture_output=True)
subprocess.run(f"ln {proc.stdout.decode('UTF-8').strip()}/lib/libomp.dylib /usr/local/lib/libomp.dylib", shell=True)

def config_options(self):
if self.settings.os == "Windows":
Expand Down Expand Up @@ -103,6 +106,12 @@ def generate(self):
tc.cache_variables["MV_UNITY_BUILD"] = "ON"
tc.cache_variables["CMAKE_CONFIGURATION_TYPES"] = "RelWithDebInfo"

if os_info.is_macos:
proc = subprocess.run("brew --prefix libomp", shell=True, capture_output=True)
prefix_path = f"{proc.stdout.decode('UTF-8').strip()}"
tc.variables["OpenMP_ROOT"] = prefix_path
os.environ['OpenMP_ROOT'] = prefix_path # for vcpkg to find omp

# Use vcpkg-installed dependencies if there are any
if os.environ.get("VCPKG_ROOT", None):
vcpkg_dir = pathlib.Path(os.environ["VCPKG_ROOT"])
Expand All @@ -111,7 +120,7 @@ def generate(self):

vcpkg_triplet = "x64-windows"
if self.settings.os == "Macos":
vcpkg_triplet = "x64-osx"
vcpkg_triplet = "arm64-osx"
if self.settings.os == "Linux":
vcpkg_triplet = "x64-linux"

Expand All @@ -127,6 +136,8 @@ def generate(self):

tc.variables["CMAKE_PROJECT_INCLUDE"] = vcpkg_tc.as_posix()

tc.cache_variables["MV_EXAMPLES_USE_VCPKG"] = "ON"

tc.generate()

def _configure_cmake(self):
Expand Down
18 changes: 10 additions & 8 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
"version": "0.0.1",
"dependencies": [
"blake3",
{
"name": "faiss",
"platform": "!osx"
}
"faiss"
],
"builtin-baseline":"d5ec528843d29e3a52d745a64b469f810b2cedbf",
"builtin-baseline":"94a541197763a4f449a1b91478df48c0584a6256",
"overrides": [
{ "name": "blake3", "version": "1.5.4" },
{ "name": "faiss", "version": "1.8.0" }
]
{ "name": "blake3", "version": "1.8.6#0" },
{ "name": "faiss", "version": "1.14.3#0" },
{ "name": "blas", "version": "2023-04-14#6" },
{ "name": "clapack", "version": "3.2.1#25" },
{ "name": "lapack", "version": "2023-06-10#4" },
{ "name": "lapack-reference", "version": "3.12.1#3" },
{ "name": "openblas", "version": "0.3.33#0" }
]
}
Loading