Skip to content

Commit

Permalink
Fix problems when using 64-bit integers. (#3322)
Browse files Browse the repository at this point in the history
Summary:
Fixes problem when compiling OpenBLAS with INTERFACE64=1 (64-bit integers).

Pull Request resolved: #3322

Reviewed By: algoriddle

Differential Revision: D55469397

Pulled By: mdouze

fbshipit-source-id: 14d916fb074f6ea0f591e0324bb7b8674a624473
  • Loading branch information
ChipKerchner authored and facebook-github-bot committed Mar 28, 2024
1 parent 55dc880 commit 03db694
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion faiss/CMakeLists.txt
Expand Up @@ -290,7 +290,10 @@ if(WIN32)
target_compile_definitions(faiss_avx512 PRIVATE FAISS_MAIN_LIB)
endif()

target_compile_definitions(faiss PRIVATE FINTEGER=int)
string(FIND "${CMAKE_CXX_FLAGS}" "FINTEGER" finteger_idx)
if (${finteger_idx} EQUAL -1)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()
target_compile_definitions(faiss_avx2 PRIVATE FINTEGER=int)
target_compile_definitions(faiss_avx512 PRIVATE FINTEGER=int)

Expand Down
16 changes: 8 additions & 8 deletions faiss/impl/LocalSearchQuantizer.cpp
Expand Up @@ -104,10 +104,10 @@ int dgemm_(

namespace {

void fmat_inverse(float* a, int n) {
int info;
int lwork = n * n;
std::vector<int> ipiv(n);
void fmat_inverse(float* a, FINTEGER n) {
FINTEGER info;
FINTEGER lwork = n * n;
std::vector<FINTEGER> ipiv(n);
std::vector<float> workspace(lwork);

sgetrf_(&n, &n, a, &n, ipiv.data(), &info);
Expand All @@ -123,10 +123,10 @@ void dfvec_add(size_t d, const double* a, const float* b, double* c) {
}
}

void dmat_inverse(double* a, int n) {
int info;
int lwork = n * n;
std::vector<int> ipiv(n);
void dmat_inverse(double* a, FINTEGER n) {
FINTEGER info;
FINTEGER lwork = n * n;
std::vector<FINTEGER> ipiv(n);
std::vector<double> workspace(lwork);

dgetrf_(&n, &n, a, &n, ipiv.data(), &info);
Expand Down

0 comments on commit 03db694

Please sign in to comment.