Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows CI #2889

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 8 additions & 2 deletions faiss/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <omp.h>

#include <algorithm>
#include <type_traits>
#include <vector>

#include <faiss/impl/AuxIndexStructures.h>
Expand Down Expand Up @@ -446,8 +447,13 @@ uint64_t bvec_checksum(size_t n, const uint8_t* a) {
}

void bvecs_checksum(size_t n, size_t d, const uint8_t* a, uint64_t* cs) {
#pragma omp parallel for if (n > 1000)
for (size_t i = 0; i < n; i++) {
// MSVC can't accept unsigned index for #pragma omp parallel for
// so below codes only accept n <= std::numeric_limits<ssize_t>::max()
using ssize_t = std::make_signed<std::size_t>::type;
const ssize_t size = n;
#pragma omp parallel for if (size > 1000)
for (ssize_t i_ = 0; i_ < size; i_++) {
const auto i = static_cast<std::size_t>(i_);
cs[i] = bvec_checksum(d, a + i * d);
}
}
Expand Down