Skip to content

Commit

Permalink
fix windows CI
Browse files Browse the repository at this point in the history
MSVC doesn't accept unsigned index with pragma omp parallel for
  • Loading branch information
wx257osn2 committed May 31, 2023
1 parent 90349f2 commit 5d8bf47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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 @@ -447,7 +448,8 @@ 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++) {
for (std::make_signed<std::size_t>::type i_ = 0; static_cast<std::size_t>(i_) < n; i_++) {
const auto i = static_cast<std::size_t>(i_);
cs[i] = bvec_checksum(d, a + i * d);
}
}
Expand Down

0 comments on commit 5d8bf47

Please sign in to comment.