use env variable to switch mem manager and fix cmake

Former-commit-id: f433a193e4086600d3a0ca2259e1f65f0d7fbc5b
pull/191/head
zhiru 2019-07-09 17:07:52 +08:00
parent ec394371d0
commit a6180ccea5
4 changed files with 20 additions and 9 deletions

View File

@ -664,7 +664,8 @@ macro(build_knowhere)
${EP_COMMON_CMAKE_ARGS}
"-DCMAKE_INSTALL_PREFIX=${KNOWHERE_PREFIX}"
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
"-DCMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}"
"-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}"
-DCMAKE_BUILD_TYPE=Release)
externalproject_add(knowhere_ep

View File

@ -3,12 +3,14 @@
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include "Factories.h"
#include "DBImpl.h"
#include "MemManager.h"
#include "NewMemManager.h"
#include "Exception.h"
#include <stdlib.h>
#include <time.h>
#include <sstream>
#include <iostream>
@ -16,7 +18,9 @@
#include <assert.h>
#include <easylogging++.h>
#include <regex>
#include "Exception.h"
#include <cstdlib>
#include <string>
#include <algorithm>
namespace zilliz {
namespace milvus {
@ -101,11 +105,17 @@ DB* DBFactory::Build(const Options& options) {
MemManagerAbstractPtr MemManagerFactory::Build(const std::shared_ptr<meta::Meta>& meta,
const Options& options) {
#ifdef USE_NEW_MEM_MANAGER
if (const char* env = getenv("MILVUS_USE_OLD_MEM_MANAGER")) {
std::string env_str = env;
std::transform(env_str.begin(), env_str.end(), env_str.begin(), ::toupper);
if (env_str == "ON") {
return std::make_shared<MemManager>(meta, options);
}
else {
return std::make_shared<NewMemManager>(meta, options);
}
}
return std::make_shared<NewMemManager>(meta, options);
#else
return std::make_shared<MemManager>(meta, options);
#endif
}
} // namespace engine

View File

@ -39,7 +39,7 @@ set(db_test_src
cuda_add_executable(db_test ${db_test_src})
set(db_libs
sqlite3
sqlite
boost_system
boost_filesystem
lz4

View File

@ -77,7 +77,7 @@ target_link_libraries(metrics_test
${knowhere_libs}
cudart
cublas
sqlite3
sqlite
boost_system
boost_filesystem
lz4