Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
remove openblas header, fix openblas always compile bug
Browse files Browse the repository at this point in the history
Signed-off-by: Yusheng.Ma <[email protected]>
  • Loading branch information
Presburger committed Sep 9, 2022
1 parent 3ca9535 commit 15c5ad4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
14 changes: 2 additions & 12 deletions cmake/ThirdPartyPackagesKw.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,8 @@ endmacro()
if (KNOWHERE_WITH_OPENBLAS)
if (OpenBLAS_SOURCE STREQUAL "AUTO")
# Protect OpenBLAS for faiss build
if (LINUX)
set (BLA_VENDOR OpenBLAS)
endif()

if ( CMAKE_BUILD_TYPE STREQUAL "Debug" OR APPLE OR MSYS)
message(STATUS "Using debug mode or host is MacOS/MSYS, try to find openblas")
find_package(BLAS)
message(STATUS "Knowhere openblas libraries: ${BLAS_LIBRARIES}")
message(STATUS "Knowhere openblas found: ${BLAS_FOUND}")
endif()


set (BLA_VENDOR OpenBLAS)
find_package(BLAS)
if (BLAS_FOUND)
add_library(openblas ALIAS BLAS::BLAS)
else()
Expand Down
1 change: 0 additions & 1 deletion thirdparty/DiskANN/src/aux_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "aux_utils.h"
#include "cached_io.h"
#include "index.h"
#include "openblas/cblas.h"
#include "omp.h"
#include "partition_and_pq.h"
#include "percentile_stats.h"
Expand Down
33 changes: 32 additions & 1 deletion thirdparty/DiskANN/src/math_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,41 @@
#include <unordered_set>
#include <malloc.h>
#include <math_utils.h>
#include "openblas/cblas.h"
#include "logger.h"
#include "utils.h"



#ifndef OPENBLAS_CONST
# define OPENBLAS_CONST const
#endif

typedef int blasint;

typedef enum CBLAS_ORDER {
CblasRowMajor = 101,
CblasColMajor = 102
} CBLAS_ORDER;
typedef enum CBLAS_TRANSPOSE {
CblasNoTrans = 111,
CblasTrans = 112,
CblasConjTrans = 113,
CblasConjNoTrans = 114
} CBLAS_TRANSPOSE;

float cblas_snrm2(const int N, const float* X, const int incX);
void cblas_sgemm(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
OPENBLAS_CONST float* A, OPENBLAS_CONST blasint lda,
OPENBLAS_CONST float* B, OPENBLAS_CONST blasint ldb,
OPENBLAS_CONST float beta, float* C,
OPENBLAS_CONST blasint ldc);



namespace math_utils {

float calc_distance(float* vec_1, float* vec_2, size_t dim) {
Expand Down

0 comments on commit 15c5ad4

Please sign in to comment.