提交 b660b49c 编写于 作者: Z zhiru 提交者: jinhai

use env variable to switch mem manager and fix cmake


Former-commit-id: 30fa1d2ca1721631298ea3233841cc15f45f87f7
上级 9e59ead8
......@@ -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
......
......@@ -66,7 +66,7 @@ target_link_libraries(metrics_test
faiss
cudart
cublas
sqlite3
sqlite
boost_system
boost_filesystem
lz4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册