Skip to content

Commit

Permalink
Oh what fun, msvc 2019 on the ci
Browse files Browse the repository at this point in the history
  • Loading branch information
alxvth committed Oct 9, 2024
1 parent c03cb83 commit 663d173
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ add_subdirectory(ExampleTransformation)
add_subdirectory(ExampleLoader)
add_subdirectory(ExampleWriter)
add_subdirectory(ExampleData)
add_subdirectory(ExampleDependencies)
# add_subdirectory(ExampleDependencies)
25 changes: 13 additions & 12 deletions ExampleDependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
endif(MSVC)

include(cmake/get_cpm.cmake)
# include(cmake/get_cpm.cmake)

# -----------------------------------------------------------------------------
# Dependencies
Expand All @@ -30,20 +30,20 @@ find_package(Qt6 COMPONENTS Widgets WebEngineWidgets REQUIRED)

find_package(ManiVault COMPONENTS Core PointData CONFIG)

find_package(blake3 CONFIG REQUIRED)
# find_package(blake3 CONFIG REQUIRED)

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

CPMAddPackage(
NAME highway
URL https://github.com/google/highway/archive/refs/tags/1.2.0.tar.gz
URL_HASH SHA256=7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343
PATCHES "cmake/highway.patch" # see https://github.com/conan-io/conan-center-index/pull/24197/files, fixes https://github.com/google/highway/issues/2225
OPTIONS "HWY_ENABLE_EXAMPLES OFF" "HWY_ENABLE_INSTALL OFF" "HWY_ENABLE_TESTS OFF" "HWY_ENABLE_CONTRIB ON" "BUILD_SHARED_LIBS ON"
)
# CPMAddPackage(
# NAME highway
# URL https://github.com/google/highway/archive/refs/tags/1.2.0.tar.gz
# URL_HASH SHA256=7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343
# PATCHES "cmake/highway.patch" # see https://github.com/conan-io/conan-center-index/pull/24197/files, fixes https://github.com/google/highway/issues/2225
# OPTIONS "HWY_ENABLE_EXAMPLES OFF" "HWY_ENABLE_INSTALL OFF" "HWY_ENABLE_TESTS OFF" "HWY_ENABLE_CONTRIB ON" "BUILD_SHARED_LIBS ON"
# )

# -----------------------------------------------------------------------------
# Source files
Expand Down Expand Up @@ -93,8 +93,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::WebEngineWidgets)
target_link_libraries(${PROJECT_NAME} PRIVATE ManiVault::Core)
target_link_libraries(${PROJECT_NAME} PRIVATE ManiVault::PointData)

target_link_libraries(${PROJECT_NAME} PRIVATE BLAKE3::blake3)
target_link_libraries(${PROJECT_NAME} PRIVATE hwy hwy_contrib)
# target_link_libraries(${PROJECT_NAME} PRIVATE BLAKE3::blake3)
# target_link_libraries(${PROJECT_NAME} PRIVATE hwy hwy_contrib)

if(NOT APPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE faiss)
Expand Down Expand Up @@ -124,7 +124,8 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
)

# Automatically available when using find_package(ManiVault)
mv_install_dependencies(${PROJECT_NAME} "hwy" "hwy_contrib")
#mv_install_dependencies(${PROJECT_NAME} "hwy" "hwy_contrib")
mv_install_dependencies(${PROJECT_NAME})

# -----------------------------------------------------------------------------
# Miscellaneous
Expand Down
40 changes: 20 additions & 20 deletions ExampleDependencies/src/ExampleDependenciesPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <stdio.h>
#include <vector>

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

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

#if !defined(__APPLE__)
#include <faiss/IndexFlat.h>
Expand Down Expand Up @@ -53,9 +53,9 @@ void ExampleDependenciesPlugin::init()

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

std::cout << "ExampleDependenciesPlugin: Using blake version: " << blake3_version() << std::endl;
//std::cout << "ExampleDependenciesPlugin: Using blake version: " << blake3_version() << std::endl;

auto printData = [](const std::vector<float>& vec, size_t dims, size_t points) {
for (size_t dim = 0; dim < dims; dim++)
Expand All @@ -81,11 +81,11 @@ void ExampleDependenciesPlugin::compute()
std::cout << "ExampleDependenciesPlugin: Data before sorting" << std::endl;
printData(data, numDims, numPoints);

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

std::cout << "ExampleDependenciesPlugin: Data after sorting" << std::endl;
printData(data, numDims, numPoints);
Expand All @@ -96,19 +96,19 @@ void ExampleDependenciesPlugin::compute()
events().notifyDatasetDataChanged(outputPoints);

// Create hash
blake3_hasher hasher;
blake3_hasher_init(&hasher);
//blake3_hasher hasher;
//blake3_hasher_init(&hasher);

blake3_hasher_update(&hasher, data.data(), data.size());
//blake3_hasher_update(&hasher, data.data(), data.size());

uint8_t output[BLAKE3_OUT_LEN];
blake3_hasher_finalize(&hasher, output, BLAKE3_OUT_LEN);
//uint8_t output[BLAKE3_OUT_LEN];
//blake3_hasher_finalize(&hasher, output, BLAKE3_OUT_LEN);

// Print the hash as hexadecimal
for (size_t i = 0; i < BLAKE3_OUT_LEN; i++) {
printf("%02x", output[i]);
}
printf("\n");
//for (size_t i = 0; i < BLAKE3_OUT_LEN; i++) {
// printf("%02x", output[i]);
//}
//printf("\n");

#if !defined(__APPLE__)
// find knn
Expand Down

0 comments on commit 663d173

Please sign in to comment.