Files
openvino/docs/snippets/GPU_Metric1.cpp
Ilya Lavrenov 68e873c6c8 Config and hetero (#10555)
* Updated properties documentation

* Fixed doc refernce

* merged snipet files

* fixed build

* Updated Hetero docs

* Self-review

Co-authored-by: Anton Pankratv <anton.pankratov@intel.com>
2022-02-21 16:01:47 +03:00

26 lines
1.4 KiB
C++

#include <openvino/runtime/core.hpp>
#include <openvino/runtime/intel_gpu/properties.hpp>
int main() {
//! [part1]
ov::Core core;
std::shared_ptr<ov::Model> model = core.read_model("network.xml");
uint32_t n_streams = 2;
int64_t available_device_mem_size = 3221225472;
ov::AnyMap options = {
ov::hint::model(model), // Required. Set the address of the target network. If this is not set, the MAX_BATCH_SIZE returns 1.
ov::num_streams(n_streams), // Optional. Set only when you want to estimate max batch size for a specific throughtput streams. Default is 1 or throughtput streams set by set_property.
ov::intel_gpu::hint::available_device_mem(available_device_mem_size) // Optional. Set only when you want to limit the available device mem size.
};
uint32_t max_batch_size = core.get_property("GPU", ov::max_batch_size, options);
//! [part1]
//! [part2]
// This is not entirely GPU-specific property (so common `ov::` property is used rather than `ov::intel_gpu::` below),
// but the GPU is the only device that supports that at the moment.
// For the GPU, the property already accommodates limitation for the on-device memory that the MAX_BATCH_SIZE poses.
// so OPTIMAL_BATCH_SIZE is always less than MAX_BATCH_SIZE. Unlike the latter it is also aligned to the power of 2.
uint32_t optimal_batch_size = core.get_property("GPU", ov::optimal_batch_size, options);
//! [part2]
}