myriad_config.h 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <map>
#include <string>
#include <unordered_set>
10
#include <chrono>
11 12 13 14 15 16 17 18

#include <vpu/parsed_config.hpp>

#include <mvnc.h>

namespace vpu {
namespace MyriadPlugin {

19 20 21 22 23 24 25 26
VPU_DECLARE_ENUM(PowerConfig,
    FULL         = 0,
    INFER        = 1,
    STAGE        = 2,
    STAGE_SHAVES = 3,
    STAGE_NCES   = 4,
)

27
struct MyriadConfig final : ParsedConfig {
28
    bool forceReset = false;
29
    PowerConfig powerConfig = PowerConfig::FULL;
30 31 32 33 34 35 36
    ncDevicePlatform_t platform = NC_ANY_PLATFORM;
    ncDeviceProtocol_t protocol = NC_ANY_PROTOCOL;
    std::chrono::milliseconds watchdogInterval = std::chrono::milliseconds(1000);
    static constexpr int UNDEFINED_THROUGHPUT_STREAMS = -1;
    int numExecutors = UNDEFINED_THROUGHPUT_STREAMS;
    std::string deviceName;

37 38 39 40 41 42 43 44 45 46
    explicit MyriadConfig(const std::map<std::string, std::string> &config = std::map<std::string, std::string>(),
                          ConfigMode mode = ConfigMode::DEFAULT_MODE);

private:
    std::unordered_set<std::string> getRuntimeOptions() const final;
    void checkInvalidValues(const std::map<std::string, std::string> &config) const final;
};

}  // namespace MyriadPlugin
}  // namespace vpu