Files
openvino/samples/cpp/benchmark_app/remote_blobs_filling.hpp
T
5b25dbee22 ov2.0 IE samples modification (#8340)
* ov2.0 IE samples modification

apply code style

turn off clang style check for headers order

unify samples a bit

add yuv nv12 reader to format_reader, helloe_nv112 sample

hello_reshape_ssd ov2.0

* sync with PR 8629 preprocessing api changes

* fix for slog << vector<int>

* add operator<< for ov::Version from PR-8687

* Update samples/cpp/hello_nv12_input_classification/main.cpp

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* apply code style

* change according to review comments

* add const qualifier

* apply code style

* std::ostream for old inference engine version to make VPU plugin tests happy

* apply code style

* revert changes in print version for old api samples

* keep inference_engine.hpp for not ov2.0 yet samples

* fix merge artifacts

* fix compilation

* apply code style

* Fixed classification sample test

* Revert changes in hello_reshape_ssd sample

* rebase to master, sync with PR-9054

* fix issues found by C++ tests

* rebased and sync with PR-9051

* fix test result parsers for classification tests (except unicode one)

* fix mismatches after merge

* rebase and sync with PR-9144

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>
Co-authored-by: antonrom23 <anton.romanov@intel.com>
2021-12-13 11:30:58 +03:00

67 lines
2.1 KiB
C++

// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#if defined(HAVE_GPU_DEVICE_MEM_SUPPORT)
# define HAVE_DEVICE_MEM_SUPPORT
# include "gpu/gpu_context_api_ocl.hpp"
#endif
// clang-format off
#include "inference_engine.hpp"
#include "infer_request_wrap.hpp"
#include "utils.hpp"
// clang-format on
namespace gpu {
#ifdef HAVE_DEVICE_MEM_SUPPORT
struct OpenCL {
cl::Context _context;
cl::Device _device;
cl::CommandQueue _queue;
explicit OpenCL(std::shared_ptr<std::vector<cl_context_properties>> media_api_context_properties = nullptr) {
// get Intel GPU OCL device, create context and queue
{
std::vector<cl::Device> devices;
std::vector<cl::Platform> platforms;
const unsigned int refVendorID = 0x8086;
cl::Platform::get(&platforms);
for (auto& p : platforms) {
p.getDevices(CL_DEVICE_TYPE_GPU, &devices);
for (auto& d : devices) {
if (refVendorID == d.getInfo<CL_DEVICE_VENDOR_ID>()) {
_device = d;
_context = cl::Context(_device);
break;
}
}
}
cl_command_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
_queue = cl::CommandQueue(_context, _device, props);
}
}
explicit OpenCL(cl_context context) {
// user-supplied context handle
_context = cl::Context(context, true);
_device = cl::Device(_context.getInfo<CL_CONTEXT_DEVICES>()[0].get(), true);
cl_command_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
_queue = cl::CommandQueue(_context, _device, props);
}
};
#endif
void fillRemoteBlobs(const std::vector<std::string>& inputFiles,
const size_t& batchSize,
benchmark_app::InputsInfo& app_inputs_info,
std::vector<InferReqWrap::Ptr> requests,
const InferenceEngine::ExecutableNetwork& exeNetwork);
} // namespace gpu