Skip to content

Commit

Permalink
Merge branch 'gha/manylinux_jenkins_ci' of https://github.com/mryzhov…
Browse files Browse the repository at this point in the history
…/openvino into gha/manylinux_jenkins_ci
  • Loading branch information
mryzhov committed Nov 14, 2024
2 parents a15c436 + a421315 commit 2a80a1e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 181 deletions.
3 changes: 0 additions & 3 deletions docs/sphinx_setup/_static/html/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ <h3>Configure Graphs</h3>
<div>
<button id="build-graphs-btn" disabled="disabled" class="build-graphs-btn">Show Graphs</button>
</div>
<div class="clear-all-btn">
<span class="clear-all-btn-content">Clear All</span>
</div>
</div>
</div>
<div class="configure-graphs-content">
Expand Down
3 changes: 0 additions & 3 deletions docs/sphinx_setup/_static/html/modalLLM.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ <h3>Configure Graphs</h3>
<div>
<button id="build-graphs-btn" disabled="disabled" class="build-graphs-btn">Show Graphs</button>
</div>
<div class="clear-all-btn">
<span class="clear-all-btn-content">Clear All</span>
</div>
</div>
</div>
<div class="configure-graphs-content">
Expand Down
76 changes: 17 additions & 59 deletions docs/sphinx_setup/_static/js/graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Filter {
.forEach(item => optionMap.set(item.Platform, item));
return Array.from(optionMap.values());
}

// param: GraphData[], ieType
static ByIeTypes(graphDataArr, ieTypes) {
const optionMap = new Map();
Expand All @@ -18,17 +17,15 @@ class Filter {
.forEach(item => optionMap.set(item.Platform, item));
return Array.from(optionMap.values());
}

// param: GraphData[], ieType, networkModels
static ByTypesAndModels(graphDataArr, ieTypes, models) {
return Array.from(
graphDataArr
.filter(({ PlatformType, Model }) => ieTypes.includes(PlatformType) && models.includes(Model))
.reduce((map, item) => map.set(item.Platform, item), new Map())
.values()
).sort((a, b) => a.Platform.localeCompare(b.Platform));
);
}

// param: GraphData[], clientPlatforms
static ByIeKpis(graphDataArr, clientPlatforms) {
return Array.from(
Expand All @@ -40,7 +37,6 @@ class Filter {
}, new Set())
);
}

// param: GraphData[]
static getParameters(graphDataArr) {
var parameters = []
Expand All @@ -51,7 +47,6 @@ class Filter {
})
return parameters;
}

// param: GraphData[]
static getIeTypes(graphDataArr) {
var kpis = []
Expand All @@ -62,21 +57,12 @@ class Filter {
})
return kpis;
}

// param: GraphData[], clientPlatforms[]
static ByClientPlatforms(graphDataArr, platformsArr) {
return graphDataArr.filter((data) => {
return platformsArr.includes(data.Platform)
});
}

// param: GraphData[], coreTypes[]
static FilterByCoreTypes(graphDataArr, coreTypes) {
if (coreTypes) {
return graphDataArr.filter((data) => coreTypes.includes(data.PlatformType));
}
return graphDataArr;
}
}

class Modal {
Expand Down Expand Up @@ -114,15 +100,13 @@ class Graph {
.sort((a, b) => a.localeCompare(b));
}
static getIeTypes(graphDataArr) {
return Array.from(new Set(graphDataArr.map((obj) => obj.PlatformType)));
}
static getCoreTypes(graphDataArr) {
return Array.from(new Set(graphDataArr.map((obj) => obj.ieType)));
return Array.from(new Set(graphDataArr.map((obj) => obj.PlatformType))).sort((a, b) => a.localeCompare(b));
}

// param: GraphData[]
static getPlatformNames(graphDataArr) {
return graphDataArr.map((data) => data.Platform);
return graphDataArr.map((data) => data.Platform)
.sort((a, b) => a.localeCompare(b));
}

// param: GraphData[], engine: string, precisions: list
Expand Down Expand Up @@ -297,13 +281,13 @@ $(document).ready(function () {
const models = networkModels.map((networkModel) => createCheckMark(networkModel, 'networkmodel'));
modal.find('.models-column').append(models);

const selectAllModelsButton = createCheckMark('', 'networkmodel');
const selectAllModelsButton = createCheckMark('', 'networkmodel', false , false);
modal.find('.models-selectall').append(selectAllModelsButton);

const selectAllPlatformsButton = createCheckMark('', 'platform');
const selectAllPlatformsButton = createCheckMark('', 'platform', false , false);
modal.find('.platforms-selectall').append(selectAllPlatformsButton);

const precisions = Modal.getPrecisionsLabels(graph).map((precision) => createCheckMark(precision, 'precision', false));
const precisions = Modal.getPrecisionsLabels(graph).map((precision) => createCheckMark(precision, 'precision', false , false));
modal.find('.precisions-column').append(precisions);

selectAllCheckboxes(precisions);
Expand All @@ -318,21 +302,17 @@ $(document).ready(function () {
modal.find('#modal-display-graphs').hide();
modal.find('.ietype-column input').first().prop('checked', true);

const kpiLabels = Filter.getParameters(graph).map((parameter) => createCheckMark(parameter, 'kpi', false));
const kpiLabels = Filter.getParameters(graph).map((parameter) => createCheckMark(parameter, 'kpi', false , true));
modal.find('.kpi-column').append(kpiLabels);

$('body').prepend(modal);

preselectDefaultSettings(graph, modal, appConfig);

//is not generic solution :(
if (appConfig.DefaultSelections.platformTypes?.data?.includes('Select All')) {
selectAllCheckboxes(iefilter);

};
preselectDefaultSettings(graph, modal, appConfig);
renderClientPlatforms(graph, modal);

$('.clear-all-btn').on('click', clearAll);
$('#build-graphs-btn').on('click', () => {
$('#modal-configure-graphs').hide();
clickBuildGraphs(graph, appConfig, getSelectedNetworkModels(), getSelectedIeTypes(), getSelectedClientPlatforms(), getSelectedKpis(), Modal.getPrecisions(appConfig, getSelectedPrecisions()), isLLM);
Expand Down Expand Up @@ -409,19 +389,9 @@ $(document).ready(function () {
precisions.prop('disabled', false);
}

function clearAll() {
$('.modal-content-grid-container input:checkbox').each((index, object) => $(object).prop('checked', false));
validatePrecisionSelection();
validateSelections();
}

function preselectDefaultSettings(graph, modal, appConfig) {

const defaultSelections = appConfig.DefaultSelections;
selectDefaultPlatformType(defaultSelections.platformTypes, graph, modal);
applyPlatformFilters(defaultSelections.platformFilters, modal, graph);
clearAllSettings(defaultSelections);

selectDefaultPlatformType(appConfig.DefaultSelections.platformTypes, graph, modal);
clearAllSettings(appConfig.DefaultSelections);
validateSelections();
validatePrecisionSelection();
}
Expand All @@ -431,17 +401,8 @@ $(document).ready(function () {
$(`input[data-ietype="${type}"]`).prop('checked', true);
renderClientPlatforms(graph, modal);
}
function applyPlatformFilters(platformFilters, modal, graph) {
if (!platformFilters) return;
const filters = modal.find('.selectable-box-container').children('.selectable-box');
filters.removeClass('selected');
platformFilters.data.forEach(selection => {
filters.filter(`[data-${platformFilters.name}="${selection}"]`).addClass('selected');
});
renderClientPlatforms(graph, modal);
}

function clearAllSettings(defaultSelections) {
clearAll();
Object.keys(defaultSelections).forEach(setting => {
const { name, data } = defaultSelections[setting];
data.forEach(selection => {
Expand All @@ -463,14 +424,15 @@ $(document).ready(function () {
var platformNames = Graph.getPlatformNames(fPlatforms);
$('.platforms-column .checkmark-container').remove();

const clientPlatforms = platformNames.map((platform) => createCheckMark(platform, 'platform', true));
const clientPlatforms = platformNames.map((platform) => createCheckMark(platform, 'platform', true, false));

var enabledPlatforms = filterPlatforms(graph, getSelectedIeTypes(), getSelectedNetworkModels());
enableCheckBoxes(clientPlatforms, enabledPlatforms);
modal.find('.platforms-column').append(clientPlatforms);

enableParmeters(graph, getSelectedClientPlatforms());
modal.find('.platforms-column input').on('click', validateSelections);
validateSelections();
}

function enableParmeters(graph, clientPlatforms) {
Expand All @@ -486,11 +448,12 @@ $(document).ready(function () {
})
}

function createCheckMark(itemLabel, modelLabel, disabled) {
function createCheckMark(itemLabel, modelLabel, disabled, checked = false) {
const item = $('<label class="checkmark-container">');
item.text(itemLabel);
const checkbox = $('<input type="checkbox"/>');
checkbox.prop('disabled', disabled);
checkbox.prop('checked', checked);
const checkboxSpan = $('<span class="checkmark">');
item.append(checkbox);
item.append(checkboxSpan);
Expand Down Expand Up @@ -732,7 +695,6 @@ $(document).ready(function () {
labelsContainer.addClass('chart-labels-container');
chartWrap.append(labelsContainer);

// get the kpi title's and create headers for the graphs
var chartGraphsContainer = $('<div>');
chartGraphsContainer.addClass('chart-graphs-container');
chartWrap.append(chartGraphsContainer);
Expand Down Expand Up @@ -778,7 +740,6 @@ $(document).ready(function () {
labelsContainer.addClass('chart-labels-container');
chartWrap.append(labelsContainer);

// get the kpi title's and create headers for the graphs
var chartGraphsContainer = $('<div>');
chartGraphsContainer.addClass('chart-graphs-container');
chartWrap.append(chartGraphsContainer);
Expand All @@ -798,7 +759,6 @@ $(document).ready(function () {
columnHeaderContainer.append(columnIcon);
var columnHeader = $('<div class="chart-header">');
columnHeader.append($('<div class="title">' + graphConfig.chartTitle + '</div>'));
// columnHeader.append($('<div class="subtitle">' + graphConfig.unit + ' ' + appConfig.UnitDescription[graphConfig.unit] + '</div>'));
columnHeaderContainer.append(columnHeader);
chartGraphsContainer.append(graphItem);
var graphClass = $('<div>');
Expand Down Expand Up @@ -857,7 +817,6 @@ $(document).ready(function () {
return graphConfigs
}
function processMetric(labels, datasets, chartTitle, container, widthClass, id) {
// ratio for consistent chart label height
var heightRatio = (30 + (labels.length * 55));
var chart = $('<div>');
const containerId = `legend-container-${id}`;
Expand Down Expand Up @@ -898,8 +857,7 @@ $(document).ready(function () {
}

function processMetricByEngines(labels, datasets, container, widthClass, id) {
// ratio for consistent chart label height
var heightRatio = (80 + (labels.length * 55));
var heightRatio = (80 + (labels.length * 55));
var chart = $('<div>');
const containerId = `legend-container-${id}`;
const legend = $(`<div id="${containerId}">`);
Expand Down
8 changes: 6 additions & 2 deletions src/bindings/python/src/pyopenvino/core/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,14 @@ py::array array_from_constant_copy(ov::op::v0::Constant&& c, py::dtype& dst_dtyp
py::array array_from_constant_view(ov::op::v0::Constant&& c) {
const auto& ov_type = c.get_element_type();
const auto dtype = Common::type_helpers::get_dtype(ov_type);
py::array data;
if (ov_type.bitwidth() < Common::values::min_bitwidth) {
return py::array(dtype, c.get_byte_size(), c.get_data_ptr(), py::cast(c));
data = py::array(dtype, c.get_byte_size(), c.get_data_ptr(), py::cast(c));
} else {
data = py::array(dtype, c.get_shape(), constant_helpers::_get_strides(c), c.get_data_ptr(), py::cast(c));
}
return py::array(dtype, c.get_shape(), constant_helpers::_get_strides(c), c.get_data_ptr(), py::cast(c));
data.attr("flags").attr("writeable") = false;
return data;
}

}; // namespace array_helpers
Expand Down
Loading

0 comments on commit 2a80a1e

Please sign in to comment.