Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / ie_device.cpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <vector>
6 #include <string>
7 #include <ie_device.hpp>
8 #include <details/ie_exception.hpp>
9 #include "description_buffer.hpp"
10
11 using namespace InferenceEngine;
12
13 FindPluginResponse InferenceEngine::findPlugin(const FindPluginRequest& req) {
14     std::vector<std::string> pluginVec;
15     switch (req.device) {
16         case TargetDevice::eCPU:
17 #ifdef ENABLE_MKL_DNN
18             pluginVec.push_back("MKLDNNPlugin");
19 #endif
20 #ifdef ENABLE_OPENVX_CVE
21             pluginVec.push_back("OpenVXPluginCVE");
22 #elif defined ENABLE_OPENVX
23             pluginVec.push_back("OpenVXPlugin");
24 #endif
25             break;
26         case TargetDevice::eGPU:
27 #ifdef ENABLE_CLDNN
28             pluginVec.push_back("clDNNPlugin");
29 #endif
30 #ifdef ENABLE_OPENVX
31             pluginVec.push_back("OpenVXPlugin");
32 #endif
33             break;
34         case TargetDevice::eFPGA:
35 #ifdef ENABLE_DLIA
36             pluginVec.push_back("dliaPlugin");
37 #endif
38 #ifdef ENABLE_OPENVX
39             pluginVec.push_back("OpenVXPlugin");
40 #endif
41             break;
42         case TargetDevice::eMYRIAD:
43 #ifdef ENABLE_MYRIAD
44             pluginVec.push_back("myriadPlugin");
45 #endif
46             break;
47         case TargetDevice::eHDDL:
48 #ifdef ENABLE_HDDL
49             pluginVec.push_back("HDDLPlugin");
50 #endif
51             break;
52         case TargetDevice::eGNA:
53 #ifdef ENABLE_GNA
54             pluginVec.push_back("GNAPlugin");
55 #endif
56             break;
57         case TargetDevice::eHETERO:
58             pluginVec.push_back("HeteroPlugin");
59             break;
60         case TargetDevice::eKMB:
61 #ifdef ENABLE_KMB
62             pluginVec.push_back("kmbPlugin");
63 #endif
64             break;
65
66         default:
67             THROW_IE_EXCEPTION << "Cannot find plugin for device: " << getDeviceName(req.device);
68     }
69     std::for_each(pluginVec.begin(), pluginVec.end(), [](std::string &name){ name = name + IE_BUILD_POSTFIX;});
70     return {pluginVec};
71 }
72
73 INFERENCE_ENGINE_API(StatusCode) InferenceEngine::findPlugin(
74         const FindPluginRequest& req, FindPluginResponse& result, ResponseDesc* resp) noexcept {
75     try {
76         result = findPlugin(req);
77     }
78     catch (const std::exception& e) {
79         return DescriptionBuffer(GENERAL_ERROR, resp) << e.what();
80     }
81     return OK;
82 }