From 7cfaa7fb36a6d17d6966f2a509c299114fc98d4f Mon Sep 17 00:00:00 2001 From: Belem Zhang Date: Wed, 13 Sep 2023 17:22:58 +0800 Subject: [PATCH] testqueue --- src/lib/assets/css/global.css | 25 +++++ src/lib/assets/js/utils.js | 30 ++++-- src/lib/components/ConfigBackends.svelte | 8 +- src/lib/components/ConfigModels.svelte | 21 ++-- src/lib/components/ConfigModelsManual.svelte | 15 ++- src/lib/components/ConfigNumOfRuns.svelte | 4 +- src/lib/components/Results.svelte | 12 +++ src/lib/components/TestQueue.svelte | 6 -- src/lib/store/store.js | 2 +- src/routes/+page.svelte | 50 +++------ src/routes/onnx/mobilenet_v2/+page.svelte | 95 ---------------- src/routes/run/mobilenet_v2/+page.svelte | 108 +++++++++++++++++++ src/routes/run/resnet50_v1/+page.svelte | 108 +++++++++++++++++++ 13 files changed, 315 insertions(+), 169 deletions(-) create mode 100644 src/lib/components/Results.svelte delete mode 100644 src/routes/onnx/mobilenet_v2/+page.svelte create mode 100644 src/routes/run/mobilenet_v2/+page.svelte create mode 100644 src/routes/run/resnet50_v1/+page.svelte diff --git a/src/lib/assets/css/global.css b/src/lib/assets/css/global.css index 5cb16ed..0b26491 100644 --- a/src/lib/assets/css/global.css +++ b/src/lib/assets/css/global.css @@ -374,4 +374,29 @@ padding: 2px 4px 2px 4px; .group, .config label.extra { margin-bottom: 4px; } +} + +.run { + text-align: center; + margin-top: 1em; +} +.run button { + padding: 4px 16px; + background-color: var(--green); + border: 1px solid var(--green); + color: white; + display: inline-block; + margin: 10px; + cursor: pointer; + box-shadow: + var(--green) 0px 10px 20px -12px, + var(--green) 0px 18px 16px -18px; +} + +.run button:hover { + background-color: var(--pink); + border: 1px solid var(--pink); + box-shadow: + var(--pink) 0px 6px 12px -8px, + var(--pink) 0px 12px 10px -12px; } \ No newline at end of file diff --git a/src/lib/assets/js/utils.js b/src/lib/assets/js/utils.js index a620e7b..9f65a2f 100644 --- a/src/lib/assets/js/utils.js +++ b/src/lib/assets/js/utils.js @@ -1,4 +1,4 @@ -import { autoStore, numberOfRunsStore, backendsStore, dataTypesStore, modelTypesStore, modelsStore, testQueueStore, resultStore } from '../../store/store' +import { autoStore, numberOfRunsStore, backendsStore, dataTypesStore, modelTypesStore, modelsStore, testQueueStore, resultsStore } from '../../store/store' import { models } from '../../config'; import { goto } from '$app/navigation'; import { base } from '$app/paths'; @@ -26,7 +26,11 @@ export const getGpu = () => { } export const addResult = (result) => { - resultStore.update((arr) => [...arr, result]); + resultsStore.update((arr) => [...arr, result]); +} + +export const resetResult = () => { + resultsStore.update(() => []); } export const clearTestQueue = () => { @@ -49,6 +53,7 @@ export const resetStore = () => { modelTypesStore.update(() => []); modelsStore.update(() => []); testQueueStore.update(() => []); + resultsStore.update(() => []); } /** @@ -100,6 +105,14 @@ modelsStore.subscribe((value) => { selectedModels = value; }); +/** + * @type {string[]} + */ +let testQueue; +testQueueStore.subscribe((value) => { + testQueue = value; +}); + export const goTo = () => { if (selectedModels.length > 0 && selectedBackends.length > 0 && selectedDataTypes.length > 0 && selectedModelTypes.length > 0) { if (selectedBackends.length > 0 && selectedBackends.length <= 8) { @@ -127,8 +140,6 @@ export const goTo = () => { let model = selectedModels.toString(); let url; - console.log(location.href + ' ' + location.pathname) - if (location.pathname === '/' || location.pathname === '/web-ai-benchmark') { url = `${base}?modeltype=${modelType}&datatype=${dataType}&backend=${backend}&run=${numOfRuns}&model=${model}` } else { @@ -147,7 +158,7 @@ export const goTo = () => { } } -export const testQueue = () => { +export const updateTestQueue = () => { /** * @type {string[]} */ @@ -195,6 +206,11 @@ export const stringToArray = (value) => { return value; }; +export const filterTestQueue = (id) => { + let filteredTestQueue = testQueue.filter((testQueue) => testQueue.id !== id); + testQueueStore.update(() => filteredTestQueue); +} + export const urlToStoreHome = (urlSearchParams) => { if (urlSearchParams.size > 0) { let modelType = urlSearchParams.get('modeltype'); @@ -262,4 +278,6 @@ export const urlToStoreHome = (urlSearchParams) => { } } } -}; \ No newline at end of file +}; + +export const sleep = (time) => new Promise(resolve => setTimeout(resolve, time)); \ No newline at end of file diff --git a/src/lib/components/ConfigBackends.svelte b/src/lib/components/ConfigBackends.svelte index 04688f5..852a955 100644 --- a/src/lib/components/ConfigBackends.svelte +++ b/src/lib/components/ConfigBackends.svelte @@ -1,6 +1,6 @@ + +
{JSON.stringify(results)}
diff --git a/src/lib/components/TestQueue.svelte b/src/lib/components/TestQueue.svelte index 720e897..33d3fef 100644 --- a/src/lib/components/TestQueue.svelte +++ b/src/lib/components/TestQueue.svelte @@ -1,11 +1,5 @@
-
- {#if selectedModels[0]} - +
+ {#if testQueue[0]} + {/if} - -
+
diff --git a/src/routes/onnx/mobilenet_v2/+page.svelte b/src/routes/onnx/mobilenet_v2/+page.svelte deleted file mode 100644 index 3d64abc..0000000 --- a/src/routes/onnx/mobilenet_v2/+page.svelte +++ /dev/null @@ -1,95 +0,0 @@ - - -
- {#if !auto} -
- - - -
- {/if} -
- MobileNetv2

- To be tested when complete MobileNetv2

-
Backends: {selectedBackends} -
Model Types: {selectedModelTypes} -
Data Types: {selectedDataTypes} -
Number of Runs: {selectedNumOfRuns}

-
- - - - -
- - diff --git a/src/routes/run/mobilenet_v2/+page.svelte b/src/routes/run/mobilenet_v2/+page.svelte new file mode 100644 index 0000000..b2eb175 --- /dev/null +++ b/src/routes/run/mobilenet_v2/+page.svelte @@ -0,0 +1,108 @@ + + +
+ {#if !auto} +
+ + + +
+ {/if} + + + +
+ {#if selectedModels[0] && !auto} + + {/if} +
+ +
+ {info} +
+ + +
+ + diff --git a/src/routes/run/resnet50_v1/+page.svelte b/src/routes/run/resnet50_v1/+page.svelte new file mode 100644 index 0000000..b2eb175 --- /dev/null +++ b/src/routes/run/resnet50_v1/+page.svelte @@ -0,0 +1,108 @@ + + +
+ {#if !auto} +
+ + + +
+ {/if} + + + +
+ {#if selectedModels[0] && !auto} + + {/if} +
+ +
+ {info} +
+ + +
+ +