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

use env variable to switch mem manager and fix cmake


Former-commit-id: 30fa1d2ca1721631298ea3233841cc15f45f87f7
上级 9e59ead8
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
// Unauthorized copying of this file, via any medium is strictly prohibited. // Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential. // Proprietary and confidential.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include "Factories.h" #include "Factories.h"
#include "DBImpl.h" #include "DBImpl.h"
#include "MemManager.h" #include "MemManager.h"
#include "NewMemManager.h" #include "NewMemManager.h"
#include "Exception.h"
#include <stdlib.h>
#include <time.h> #include <time.h>
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
...@@ -16,7 +18,9 @@ ...@@ -16,7 +18,9 @@
#include <assert.h> #include <assert.h>
#include <easylogging++.h> #include <easylogging++.h>
#include <regex> #include <regex>
#include "Exception.h" #include <cstdlib>
#include <string>
#include <algorithm>
namespace zilliz { namespace zilliz {
namespace milvus { namespace milvus {
...@@ -101,11 +105,17 @@ DB* DBFactory::Build(const Options& options) { ...@@ -101,11 +105,17 @@ DB* DBFactory::Build(const Options& options) {
MemManagerAbstractPtr MemManagerFactory::Build(const std::shared_ptr<meta::Meta>& meta, MemManagerAbstractPtr MemManagerFactory::Build(const std::shared_ptr<meta::Meta>& meta,
const Options& options) { const Options& options) {
#ifdef USE_NEW_MEM_MANAGER if (const char* env = getenv("MILVUS_USE_OLD_MEM_MANAGER")) {
return std::make_shared<NewMemManager>(meta, options); std::string env_str = env;
#else std::transform(env_str.begin(), env_str.end(), env_str.begin(), ::toupper);
if (env_str == "ON") {
return std::make_shared<MemManager>(meta, options); return std::make_shared<MemManager>(meta, options);
#endif }
else {
return std::make_shared<NewMemManager>(meta, options);
}
}
return std::make_shared<NewMemManager>(meta, options);
} }
} // namespace engine } // namespace engine
......
...@@ -66,7 +66,7 @@ target_link_libraries(metrics_test ...@@ -66,7 +66,7 @@ target_link_libraries(metrics_test
faiss faiss
cudart cudart
cublas cublas
sqlite3 sqlite
boost_system boost_system
boost_filesystem boost_filesystem
lz4 lz4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册