Skip to content

Commit 69b8cbc

Browse files
authored
Fix all MSVC compilation issues (#250)
Fix all compilation issues with MSVC and also enable windows build in wheels and tests
1 parent 209dafa commit 69b8cbc

28 files changed

+298
-245
lines changed

.github/workflows/build-wheels.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ jobs:
7272
- [ ubuntu-22.04, manylinux_x86_64 ]
7373
- [ macos-13, macosx_x86_64 ]
7474
- [ macos-13, macosx_arm64 ]
75-
# Windows build is currently disabled since the C++ build fails on multiple errors e.g. file manipulation
76-
# and std::filesystem::path implicit to string conversion.
77-
# Follow up task https://app.shortcut.com/tiledb-inc/story/41119/enable-windows-build-for-vector-search-repository
75+
- [ windows-2022, win_amd64 ]
7876
python: [ "cp39", "cp310", "cp311", "cp312", "pp39" ]
7977
exclude:
8078
- buildplat: [ macos-13, macosx_arm64 ]

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ jobs:
1010
run-tests:
1111
strategy:
1212
matrix:
13-
os: [ubuntu-latest]
13+
os: [ubuntu-latest, windows-latest]
1414
runs-on: ${{ matrix.os }}
1515
steps:
1616
- name: Install OpenBLAS
17+
if: ${{ runner.os == 'Linux' }}
1718
run: sudo apt install libopenblas-dev
1819
- uses: actions/checkout@v3
1920
- name: Configure CMake
2021
run: cmake -S ./src -B ./src/build -DCMAKE_BUILD_TYPE=Debug -DTILEDB_VS_ENABLE_BLAS=ON
2122
- name: Build
2223
run: cmake --build ./src/build -j3
24+
- name: Fix Windows dll inclusion with ctest
25+
if: ${{ runner.os == 'Windows' }}
26+
run: |
27+
cp .\src\build\externals\install\bin\tiledb.dll D:/a/TileDB-Vector-Search/TileDB-Vector-Search/src/build/libtiledbvectorsearch/include/test
2328
- name: Run Tests
2429
run: cmake --build ./src/build --target check-ci

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ endif()
103103
# Control compiler-specific flags.
104104
include(CompilerFlags)
105105

106+
if (MSVC)
107+
add_compile_options(/bigobj)
108+
add_compile_definitions("_ITERATOR_DEBUG_LEVEL=0")
109+
endif()
110+
106111
if (NOT $ENV{CIBUILDWHEEL} EQUAL 1 AND NOT $ENV{CONDA_BUILD} EQUAL 1)
107112
if(MSVC)
108113
set(CMAKE_CXX_FLAGS_DEBUG "/Od /Zi /EHsc /RTC1" CACHE STRING "" FORCE)

src/cmake/Superbuild.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ add_custom_target(
150150

151151
# make check
152152
add_custom_target(check
153-
COMMAND ${CMAKE_CTEST_COMMAND} --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure
153+
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure
154154
)
155155

156156
add_custom_target(check-ci
157-
COMMAND ${CMAKE_CTEST_COMMAND} --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure -E \"unit_slicing|unit_ivf_index\"
157+
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure --extra-verbose -E \"unit_slicing|unit_ivf_index\"
158158
)

src/include/detail/linalg/tdb_partitioned_matrix.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#ifndef TILEDB_PARTITIONED_MATRIX_H
5858
#define TILEDB_PARTITIONED_MATRIX_H
5959

60+
#include <algorithm>
6061
#include <cstddef>
6162
#include <future>
6263
#include <memory>
@@ -373,8 +374,8 @@ class tdbPartitionedMatrix
373374
}
374375

375376
// auto max_resident_parts = 0UL;
376-
auto running_resident_parts = 0UL;
377-
auto running_resident_size = 0UL;
377+
size_t running_resident_parts = 0UL;
378+
size_t running_resident_size = 0UL;
378379
for (size_t i = 0; i < total_num_parts_; ++i) {
379380
auto part_size = master_indices_[relevant_parts_[i] + 1] -
380381
master_indices_[relevant_parts_[i]];

src/include/index/index_defs.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ enum class IndexKind {
7979
[[maybe_unused]] static std::string current_storage_version{"0.3"};
8080

8181
// @todo Use enum for key rather than string?
82-
using StorageFormat =
83-
std::map<std::string, std::map<std::string, std::filesystem::path>>;
82+
using StorageFormat = std::map<std::string, std::map<std::string, std::string>>;
8483
[[maybe_unused]] static StorageFormat storage_formats = {
8584
{"0.1",
8685
{

src/include/index/index_group.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class base_index_group {
7676

7777
protected:
7878
std::reference_wrapper<const tiledb::Context> cached_ctx_;
79-
std::filesystem::path group_uri_;
79+
std::string group_uri_;
8080
size_t index_timestamp_{0};
8181
size_t group_timestamp_{0};
8282
size_t timetravel_index_{0};
@@ -279,12 +279,16 @@ class base_index_group {
279279
/** Convert an array name to a uri. */
280280
constexpr std::string array_name_to_uri(
281281
const std::string& array_name) const noexcept {
282-
return group_uri_ / array_name;
282+
return (std::filesystem::path{group_uri_} /
283+
std::filesystem::path{array_name})
284+
.string();
283285
}
284286

285287
/** Convert an array key to a uri. */
286288
constexpr std::string array_key_to_uri(const std::string& array_key) const {
287-
return group_uri_ / array_key_to_array_name(array_key);
289+
return (std::filesystem::path{group_uri_} /
290+
std::filesystem::path{array_key_to_array_name(array_key)})
291+
.string();
288292
}
289293

290294
public:
@@ -532,7 +536,7 @@ class base_index_group {
532536
std::cout << "# " + msg << std::endl;
533537
}
534538
std::cout << "-------------------------------------------------------\n";
535-
std::cout << "Stored in " + group_uri_.string() + ":" << std::endl;
539+
std::cout << "Stored in " + group_uri_ + ":" << std::endl;
536540
auto cfg = tiledb::Config();
537541
auto read_group = tiledb::Group(cached_ctx_, group_uri_, TILEDB_READ, cfg);
538542
for (size_t i = 0; i < read_group.member_count(); ++i) {

src/include/index/vamana_index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ auto greedy_search(
229229
// @todo (actually it does, but shouldn't need it -- need to
230230
// investigate) if (result.template insert /*<unique_id>*/ (score, p)) {
231231
if (result.template insert<unique_id>(score, p)) {
232-
q2.template insert /*<unique_id>*/ (score, p);
232+
q2.insert(score, p);
233233
}
234234
}
235235
}

0 commit comments

Comments
 (0)