EngineFactory.cpp 2.1 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#include "EngineFactory.h"
X
xj.lin 已提交
7
//#include "FaissExecutionEngine.h"
S
starlord 已提交
8
#include "ExecutionEngineImpl.h"
G
groot 已提交
9 10 11
#include "Log.h"

namespace zilliz {
J
jinhai 已提交
12
namespace milvus {
G
groot 已提交
13 14
namespace engine {

S
starlord 已提交
15
#if 0
G
groot 已提交
16 17
ExecutionEnginePtr
EngineFactory::Build(uint16_t dimension,
Y
yu yunfeng 已提交
18 19 20 21 22 23 24 25
                     const std::string &location,
                     EngineType type) {

    ExecutionEnginePtr execution_engine_ptr;

    switch (type) {
        case EngineType::FAISS_IDMAP: {
            execution_engine_ptr =
26
                ExecutionEnginePtr(new FaissExecutionEngine(dimension, location, BUILD_INDEX_TYPE_IDMAP, "IDMap,Flat"));
Y
yu yunfeng 已提交
27 28 29
            break;
        }

S
starlord 已提交
30
        case EngineType::FAISS_IVFFLAT_GPU: {
Y
yu yunfeng 已提交
31
            execution_engine_ptr =
32
                ExecutionEnginePtr(new FaissExecutionEngine(dimension, location, BUILD_INDEX_TYPE_IVF, "IDMap,Flat"));
Y
yu yunfeng 已提交
33 34 35
            break;
        }

S
starlord 已提交
36 37
        case EngineType::FAISS_IVFSQ8: {
            execution_engine_ptr =
38
                    ExecutionEnginePtr(new FaissExecutionEngine(dimension, location, BUILD_INDEX_TYPE_IVFSQ8, "IDMap,Flat"));
Y
yu yunfeng 已提交
39 40 41 42 43
            break;
        }

        default: {
            ENGINE_LOG_ERROR << "Unsupported engine type";
G
groot 已提交
44
            return nullptr;
Y
yu yunfeng 已提交
45
        }
G
groot 已提交
46
    }
Y
yu yunfeng 已提交
47 48 49

    execution_engine_ptr->Init();
    return execution_engine_ptr;
G
groot 已提交
50
}
S
starlord 已提交
51 52 53 54 55 56 57 58 59 60 61
#else
ExecutionEnginePtr
EngineFactory::Build(uint16_t dimension,
                     const std::string &location,
                     EngineType type) {

    if(type == EngineType::INVALID) {
        ENGINE_LOG_ERROR << "Unsupported engine type";
        return nullptr;
    }

X
xj.lin 已提交
62
    ENGINE_LOG_DEBUG << "EngineFactory EngineTypee: " << int(type);
S
starlord 已提交
63 64 65 66 67 68 69
    ExecutionEnginePtr execution_engine_ptr =
            std::make_shared<ExecutionEngineImpl>(dimension, location, type);

    execution_engine_ptr->Init();
    return execution_engine_ptr;
}
#endif
G
groot 已提交
70 71 72 73

}
}
}