Publishing 2020.3.2 LTS content (#5290)

* Publishing 2020.3.2 LTS content
This commit is contained in:
Alexey Suhov
2021-04-16 21:43:32 +03:00
committed by GitHub
parent f26da46e3b
commit 0b3773b740
12 changed files with 83 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Deep Learning Deployment Toolkit repository
[![Stable release](https://img.shields.io/badge/version-2020.3-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2020.3.0)
[![Stable release](https://img.shields.io/badge/version-2020.3-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2020.3.2)
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
This toolkit allows developers to deploy pre-trained deep learning models

View File

@@ -19,7 +19,7 @@ set(VPU_SUPPORTED_FIRMWARES usb-ma2450 usb-ma2x8x pcie-ma248x)
# Default packages
#
set(FIRMWARE_PACKAGE_VERSION 1119)
set(FIRMWARE_PACKAGE_VERSION 1656)
#
# CMake variables to override default firmware files

View File

@@ -23,14 +23,14 @@ class BitMap : public Reader {
private:
static Register<BitMap> reg;
typedef struct {
typedef struct BmpHeaderType {
unsigned short type = 0u; /* Magic identifier */
unsigned int size = 0u; /* File size in bytes */
unsigned int reserved = 0u;
unsigned int offset = 0u; /* Offset to image data, bytes */
} BmpHeader;
typedef struct {
typedef struct BmpInfoHeaderType {
unsigned int size = 0u; /* Header size in bytes */
int width = 0, height = 0; /* Width and height of image */
unsigned short planes = 0u; /* Number of colour planes */

View File

@@ -97,5 +97,7 @@ DECLARE_VPU_MYRIAD_CONFIG_KEY(PLUGIN_LOG_FILE_PATH);
DECLARE_VPU_MYRIAD_CONFIG_KEY(DEVICE_CONNECT_TIMEOUT);
DECLARE_VPU_MYRIAD_CONFIG_KEY(ENABLE_ASYNC_DMA);
} // namespace VPUConfigParams
} // namespace InferenceEngine

View File

@@ -100,6 +100,7 @@ IE_SUPPRESS_DEPRECATED_END
setOption(_pluginLogFilePath, config, VPU_MYRIAD_CONFIG_KEY(PLUGIN_LOG_FILE_PATH));
setOption(_deviceName, config, CONFIG_KEY(DEVICE_ID));
setOption(_forceReset, switches, config, VPU_MYRIAD_CONFIG_KEY(FORCE_RESET));
setOption(_enableAsyncDma, switches, config, VPU_MYRIAD_CONFIG_KEY(ENABLE_ASYNC_DMA));
setOption(_platform, platforms, config, VPU_MYRIAD_CONFIG_KEY(PLATFORM));
setOption(_protocol, protocols, config, VPU_MYRIAD_CONFIG_KEY(PROTOCOL));
setOption(_watchdogInterval, watchdogIntervals, config, VPU_MYRIAD_CONFIG_KEY(WATCHDOG));

View File

@@ -35,6 +35,10 @@ public:
return _forceReset;
}
bool asyncDma() const {
return _enableAsyncDma;
}
PowerConfig powerConfig() const {
return _powerConfig;
}
@@ -68,6 +72,7 @@ protected:
private:
std::string _pluginLogFilePath;
bool _forceReset = false;
bool _enableAsyncDma = true;
PowerConfig _powerConfig = PowerConfig::FULL;
ncDevicePlatform_t _platform = NC_ANY_PLATFORM;
ncDeviceProtocol_t _protocol = NC_ANY_PROTOCOL;

View File

@@ -89,6 +89,7 @@ ncStatus_t MyriadExecutor::bootNextDevice(std::vector<DevicePtr> &devicePool,
const ncDeviceProtocol_t& configProtocol = config.protocol();
const std::string& configDevName = config.deviceName();
PowerConfig powerConfig = config.powerConfig();
int enableAsyncDma = config.asyncDma();
int lastDeviceIdx = devicePool.empty() ? -1 : devicePool.back()->_deviceIdx;
ncStatus_t statusOpen = NC_ERROR;
@@ -204,6 +205,14 @@ ncStatus_t MyriadExecutor::bootNextDevice(std::vector<DevicePtr> &devicePool,
return status;
}
status = ncDeviceSetOption(device._deviceHandle, NC_RW_ENABLE_ASYNC_DMA, reinterpret_cast<void*>(&enableAsyncDma), sizeof(dataLength));
if (status != NC_OK) {
_log->warning("Failed to set option for async DMA");
ncDeviceClose(&device._deviceHandle, _mvnc->watchdogHndl());
return status;
}
/* TODO: what should we do if we do not know maximum available graphs? What if we got number <= 0? */
device._graphNum = 1;
device._deviceIdx = lastDeviceIdx + 1;

View File

@@ -25,6 +25,7 @@
#include <array>
#include <string>
#include <utility>
#include <stdexcept>
namespace kernel_selector {
#define KERNEL_SELECTOR_TENSOR_DIM_MAX 9

View File

@@ -121,6 +121,7 @@ typedef enum {
NC_RO_DEVICE_PROTOCOL = 2018, // returns device protocol (USB, PCIe)
NC_RW_DEVICE_POWER_CONFIG = 2100, // writes config for the power manager to device
NC_RW_DEVICE_POWER_CONFIG_RESET = 2101, // resets power manager config on device
NC_RW_ENABLE_ASYNC_DMA = 2102 // enable/disable asynchronous DMA on device
} ncDeviceOption_t;
typedef enum {

View File

@@ -113,7 +113,8 @@ typedef enum {
DEVICE_SET_STDIO_REDIRECT_XLINK = 5,
DEVICE_SET_POWER_CONFIG = 6,
DEVICE_RESET_POWER_CONFIG = 7,
DEVICE_COMMAND_LAST = 8
DEVICE_ENABLE_ASYNC_DMA = 8,
DEVICE_COMMAND_LAST = 9
} deviceCommandType_t;
typedef struct {

View File

@@ -82,8 +82,23 @@ static OVERLAPPED global_lock_overlap = { 0 };
#define GLOBAL_UNLOCK() UnlockFileEx(global_lock_fd, 0, MAXDWORD, MAXDWORD, &global_lock_overlap)
#else
static int global_lock_fd = -1;
#define GLOBAL_LOCK() flock(global_lock_fd, LOCK_EX)
#define GLOBAL_UNLOCK() flock(global_lock_fd, LOCK_UN)
#define GLOBAL_LOCK() \
do { \
CHECK_MUTEX_SUCCESS_RC(flock(global_lock_fd, LOCK_EX), NC_ERROR); \
if (pthread_mutex_lock(&deviceOpenMutex) != 0) { \
CHECK_MUTEX_SUCCESS(flock(global_lock_fd, LOCK_UN)); \
return NC_ERROR; \
} \
} while (0)
#define GLOBAL_UNLOCK() \
do { \
if (flock(global_lock_fd, LOCK_UN) != 0) { \
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex)); \
return NC_ERROR; \
} \
CHECK_MUTEX_SUCCESS_RC(pthread_mutex_unlock(&deviceOpenMutex), NC_ERROR); \
} while (0)
#endif
#define STRINGIFY(_text) #_text
@@ -743,17 +758,10 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
}
GLOBAL_LOCK();
int error = pthread_mutex_lock(&deviceOpenMutex);
if (error) {
GLOBAL_UNLOCK();
mvLog(MVLOG_ERROR, "pthread_mutex_lock(&deviceOpenMutex) failed with error: %d", error);
return NC_ERROR;
}
if (!initialized) {
ncStatus_t sc;
if ((sc = initializeXLink()) != 0) {
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return sc;
}
@@ -769,7 +777,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
}
if (rc != X_LINK_SUCCESS) {
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return parseXLinkError(NC_ERROR);
}
@@ -789,7 +796,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
d->wd_interval = watchdogInterval;
*deviceHandlePtr = dH;
} else {
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
mvLog(MVLOG_ERROR, "Memory allocation failed");
free(d);
@@ -799,7 +805,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
if (d->dev_addr == NULL) {
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_OUT_OF_MEMORY;
}
@@ -811,7 +816,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
if (!handler) {
mvLog(MVLOG_ERROR, "Memory allocation failed");
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_OUT_OF_MEMORY;
}
@@ -841,7 +845,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
mvLog(MVLOG_ERROR, "Can't get firmware, error: %s", ncStatusToStr(sc));
free(handler);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_MVCMD_NOT_FOUND;
}
@@ -852,7 +855,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
__func__, XLinkErrorToStr(rc), d->dev_addr);
free(handler);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_ERROR;
} else {
@@ -911,7 +913,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
mvLog(MVLOG_ERROR, "Can't get firmware, error: %s", ncStatusToStr(sc));
free(handler);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_MVCMD_NOT_FOUND;
}
@@ -1012,7 +1013,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
}
free(handler);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_ERROR;
}
@@ -1023,7 +1023,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
mvLog(MVLOG_ERROR, "Failed connection to device (%s) with error %d", d->dev_addr, rc);
free(handler);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return parseXLinkError(rc);
}
@@ -1036,7 +1035,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
if (d->dev_addr == NULL || d->dev_addr_booted == NULL || d->xlink == NULL) {
mvLog(MVLOG_ERROR, "device is invalid");
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_INVALID_HANDLE;
}
@@ -1044,11 +1042,10 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
devices = d;
mvLog(MVLOG_INFO, "XLinkConnect done - link Id %d\n", handler->linkId);
int error = 0;
if ((error = pthread_mutex_init(&d->dev_data_m, NULL)) != 0) {
mvLog(MVLOG_ERROR, "pthread_mutex_init (dev_data_m) failed with error: %d", error);
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_ERROR;
}
@@ -1057,7 +1054,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
mvLog(MVLOG_ERROR, "pthread_mutex_init (dev_stream_m) failed with error: %d", error);
CHECK_MUTEX_SUCCESS(pthread_mutex_destroy(&d->dev_data_m));
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_ERROR;
}
@@ -1066,7 +1062,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
CHECK_MUTEX_SUCCESS(pthread_mutex_destroy(&d->dev_data_m));
CHECK_MUTEX_SUCCESS(pthread_mutex_destroy(&d->dev_stream_m));
destroyDeviceHandle(deviceHandlePtr);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
return NC_ERROR;
}
@@ -1082,7 +1077,6 @@ ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t **deviceHandlePtr,
sleepForSeconds(1);
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&deviceOpenMutex));
GLOBAL_UNLOCK();
streamId_t deviceMonitorStreamId = XLinkOpenStream(d->xlink->linkId, "deviceMonitor", CONFIG_STREAM_SIZE);
@@ -1933,22 +1927,24 @@ ncStatus_t checkGraphMonitorResponse(streamId_t graphMonStream) {
return NC_OK;
}
static void lockAllInferences() {
static ncStatus_t lockAllInferences() {
GLOBAL_LOCK();
struct _devicePrivate_t *d = devices;
while (d) {
CHECK_MUTEX_SUCCESS(pthread_mutex_lock(&d->graph_stream_m));
d = d->next;
}
return;
return NC_OK;
}
static void unlockAllInferences() {
static ncStatus_t unlockAllInferences() {
struct _devicePrivate_t *d = devices;
while (d) {
CHECK_MUTEX_SUCCESS(pthread_mutex_unlock(&d->graph_stream_m));
d = d->next;
}
return;
GLOBAL_UNLOCK();
return NC_OK;
}
ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
@@ -1998,7 +1994,12 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
}
GLOBAL_UNLOCK();
lockAllInferences();
rc = lockAllInferences();
if (rc != 0) {
mvLog(MVLOG_ERROR, "can't lock all inferences");
unlockAllInferences();
return rc;
}
g->id = graphIdCount++;
streamId_t streamId;
@@ -2163,7 +2164,11 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
g->debug_buffer = g->aux_buffer;
g->time_taken = (float *) (g->aux_buffer + 120);
unlockAllInferences();
rc = unlockAllInferences();
if (rc != 0) {
mvLog(MVLOG_ERROR, "Can't unlock all inferences");
return rc;
}
GLOBAL_LOCK();
g->dev = d;
@@ -2516,6 +2521,7 @@ ncStatus_t ncGraphGetOption(struct ncGraphHandle_t * graphHandle,
if (opAccess != NC_OP_ACCESS_READ_ONLY &&
opAccess != NC_OP_ACCESS_READ_WRITE) {
mvLog(MVLOG_ERROR, "There is no such option");
GLOBAL_UNLOCK();
return NC_INVALID_PARAMETERS;
}
@@ -2685,20 +2691,32 @@ static ncStatus_t getDeviceOption(struct _devicePrivate_t *d,
return rc;
}
static ncStatus_t setDevicePowerConfig(struct _devicePrivate_t *d,
static ncStatus_t setDeviceOption(struct _devicePrivate_t *d,
ncDeviceOption_t option,
const void *data, unsigned int dataLength){
XLinkError_t rc = X_LINK_SUCCESS;
deviceCommand_t config;
if (option != NC_RW_DEVICE_POWER_CONFIG_RESET && option != NC_RW_DEVICE_POWER_CONFIG) {
mvLog(MVLOG_ERROR, "No such option");
return NC_INVALID_PARAMETERS;
switch (option) {
case NC_RW_DEVICE_POWER_CONFIG_RESET: {
config.type = DEVICE_RESET_POWER_CONFIG;
break;
}
case NC_RW_DEVICE_POWER_CONFIG: {
config.type = DEVICE_SET_POWER_CONFIG;
break;
}
case NC_RW_ENABLE_ASYNC_DMA: {
config.type = DEVICE_ENABLE_ASYNC_DMA;
break;
}
default: {
mvLog(MVLOG_ERROR, "No such option");
return NC_INVALID_PARAMETERS;
}
}
config.type = (option == NC_RW_DEVICE_POWER_CONFIG ? DEVICE_SET_POWER_CONFIG : DEVICE_RESET_POWER_CONFIG);
config.arg = *(uint32_t*)data;
rc = XLinkWriteData(d->device_mon_stream_id, (const uint8_t *)&config, sizeof(config));
if (rc != X_LINK_SUCCESS)
@@ -2748,20 +2766,11 @@ ncStatus_t ncDeviceSetOption(struct ncDeviceHandle_t *deviceHandle,
if (opAccess != NC_OP_ACCESS_READ_WRITE) {
mvLog(MVLOG_ERROR, "There is no such option");
GLOBAL_UNLOCK();
return NC_INVALID_PARAMETERS;
}
switch (option) {
case NC_RW_DEVICE_POWER_CONFIG:
case NC_RW_DEVICE_POWER_CONFIG_RESET:
{
rc = setDevicePowerConfig(d, option, data, dataLength);
break;
}
default:
rc = NC_INVALID_PARAMETERS;
mvLog(MVLOG_ERROR, "There is no such option");
}
setDeviceOption(d, option, data, dataLength);
GLOBAL_UNLOCK();
return rc;
@@ -2817,6 +2826,7 @@ ncStatus_t ncDeviceGetOption(struct ncDeviceHandle_t * deviceHandle,
if (opAccess != NC_OP_ACCESS_READ_ONLY &&
opAccess != NC_OP_ACCESS_READ_WRITE) {
mvLog(MVLOG_ERROR, "There is no such option");
GLOBAL_UNLOCK();
return NC_INVALID_PARAMETERS;
}

View File

@@ -1,3 +1,3 @@
networkx>=1.11
numpy==1.13.0
numpy>=1.12.0
defusedxml>=0.5.0