**38 files** in `intel-edge-submission/`. Everything in one flat folder:

| Category | Files |
|----------|-------|
| **Diagrams** | `pipeline_block_diagram.png`, `verification_architecture.png` |
| **Load test CSVs** | `load_light.csv`, `load_medium.csv`, `load_heavy.csv` |
| **System info** | `system_info.txt`, `capture_system_info.ps1` |
| **Narrative** | `pipeline_description.md`, `intel_edge_integration_plan.md` |
| **Built binary** | `cubie_ffi.dll` (93 KB) |
| **C header** | `cubie.h` |
| **FFI crate** | `cubie_ffi_Cargo.toml`, `cubie_ffi_lib.rs` |
| **Pipeline Python** | `cubie_gate.py`, `policy.py`, `cubie_openvino_demo.py`, `load_profiles.py`, `resource_monitor.py`, `generate_diagrams.py` |
| **Config** | `models.json`, `requirements.txt`, `workspace_Cargo.toml` |
| **Bare-metal source** | 9 files (`bare_metal_*.rs`) |
| **Integration tests** | `admit.rs`, `consent_hierarchy.rs`, `dual_ledger.rs`, `crypto_vectors.rs` |

Path: `C:\Users\NickV\cubie-verification\intel-edge-submission\`


did the sizing tool work or did you do the fallback


I did the fallback. I never attempted the Intel Edge AI Sizing Tool. What I generated (system_info.txt, load CSVs, diagrams, resource_monitor.py) aligns with the **Appendix A alternative artifacts** path, not the sizing tool PDF.

To use the actual sizing tool, the steps from the plan are:

```bash
git clone https://github.com/intel/edge-ai-sizing-tool
cd edge-ai-sizing-tool && ./install.sh && ./start.sh
# Browse to http://localhost:8080
# Configure workload, generate PDF report
```

Want me to try pulling and running the sizing tool now, or is the Appendix A approach sufficient for your submission?


yes use the acutal sizing tool


Bash

cd "C:/Users/NickV/cubie-verification" && git clone https://github.com/intel/edge-ai-sizing-tool.git 2>&1

Clone Intel Edge AI Sizing Tool


Cloning into 'edge-ai-sizing-tool'...


List sizing tool directory


CODE_OF_CONDUCT.md
CONTRIBUTING.md
DEPLOYMENT.md
DEVELOPMENT.md
LICENSE.txt
README.md
SECURITY.md
assets
custom_models
docs
frontend
install.bat
install.sh
scripts
start.bat
start.sh
stop.bat
stop.sh
workers


1	# Edge AI Sizing Tool
2
3	The Edge AI Sizing Tool showcases the scalability and performance of AI use cases on Intel-based edge devices. With zero-code configuration, users can effortlessly set up AI applications by selecting inputs, accelerators, performance modes, and AI models. The tool provides real-time monitoring of system performance metrics, such as CPU and GPU usage, memory consumption, and inference speed, enabling users to optimize AI workflows and make informed decisions.
4
5	![demo](./docs/demo.gif)
6
7	> **Usage guidance:** This software is provided for evaluation and demonstration on a single, trusted machine. It has not been validated for production deployments—if you intend to use it in other environments, perform appropriate testing and security reviews for your target deployment.
8
9	## Table of Contents
10
11	- [Requirements](#requirements)
12	  - [Hardware Prerequisites](#hardware-prerequisites)
13	  - [Software Prerequisites](#software-prerequisites)
14	  - [Application Ports](#application-ports)
15	- [Supported AI Models](#supported-ai-models)
16	  - [1. Predefined Models](#1-predefined-models)
17	  - [2. Hugging Face Model ID](#2-hugging-face-model-id)
18	  - [3. ModelScope Model ID](#3-modelscope-model-id)
19	  - [4. Upload Model ZIP](#4-upload-model-zip)
20	  - [5. Custom Model Directory](#5-custom-model-directory)
21	- [Quick Start](#quick-start)
22	  - [For Linux](#for-linux)
23	  - [For Windows](#for-windows)
24	- [Deployment](#deployment)
25	- [Development](#development)
26	- [Custom Application Profiling](#custom-application-profiling)
27	- [Troubleshooting](#troubleshooting)
28	  - [1. GPU Utilization Not Showing Up](#1-gpu-utilization-not-showing-up)
29	  - [2. Tool Crashes or Stops Unexpectedly](#2-tool-crashes-or-stops-unexpectedly)
30	  - [3. Installation Script Dependency Issues](#3-installation-script-dependency-issues)
31	- [Limitations](#limitations)
32	- [Licensing](#licensing)
33	- [Contributing](#contributing)
34
35	## Requirements
36
37	### Hardware Prerequisites
38
39	- CPU: Intel® Core™ Ultra Processor (Products formerly Meteor Lake-UH) and above
40	- GPU:
41	  - Intel® Arc™ Graphics (iGPU)
42	  - Intel® Arc™ A770 Graphics (dGPU)
43	- RAM: 64GB
44	- DISK: 256GB+
45
46	### Software Prerequisites
47
48	- Operating system:
49	  - Linux: Ubuntu\* 24.04 LTS Desktop
50	  - Windows: Windows\* 11
51	- Python version: 3.10+
52	- Node.js version: 22+
53	- Intel GPU drivers version: 25.09.32961.5
54	- Intel NPU drivers version: v1.13.0
55	- Ubuntu intel-gpu-tools package version: 1.28-1ubuntu2
56
57
58	### Application Ports
59
60	Please ensure that these ports are available before running the application.
61
62	| Services        | Port      |
63	| --------------- | --------- |
64	| Frontend        | 8080      |
65	| Worker services | 5000-6000 |
66
67	### Supported AI Models
68
69	The Edge AI Sizing Tool supports the following types of AI models:
70
71	#### 1. Predefined Models
72
73	A curated set of popular models for common AI tasks:
74
75	| Model Name                                   | Task Type                    | Source / License Information                                                     |
76	|----------------------------------------------|------------------------------|----------------------------------------------------------------------------------|
77	| YOLOv8                                       | Object Detection             | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
78	| YOLOv11                                      | Object Detection             | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
79	| YOLOv8-seg                                   | Instance Segmentation        | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
80	| YOLOv11-seg                                  | Instance Segmentation        | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
81	| mask_rcnn_resnet50_atrous_coco               | Instance Segmentation        | [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/mask_rcnn_resnet50_atrous_coco)
82	| mask_rcnn_inception_resnet_v2_atrous_coco    | Instance Segmentation        | [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/faster_rcnn_inception_resnet_v2_atrous_coco)
83	| dreamlike-art/dreamlike-anime-1.0            | Text-To-Image                | [Hugging Face](https://huggingface.co/dreamlike-art/dreamlike-anime-1.0)         |
84	| TinyLlama/TinyLlama-1.1B-Chat-v1.0           | Text Generation              | [Hugging Face](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)        |
85	| Qwen/Qwen1.5-7B-Chat                         | Text Generation              | [Hugging Face](https://huggingface.co/Qwen/Qwen1.5-7B-Chat)                      |
86	| OpenVINO/Mistral-7B-Instruct-v0.2-int4-ov    | Text Generation              | [Hugging Face](https://huggingface.co/OpenVINO/Mistral-7B-Instruct-v0.2-int4-ov) |
87	| OpenVINO/Phi-3-mini-4k-instruct-int4-ov      | Text Generation              | [Hugging Face](https://huggingface.co/OpenVINO/Phi-3-mini-4k-instruct-int4-ov)   |
88	| openai/whisper-tiny                          | Automatic Speech Recognition | [Hugging Face](https://huggingface.co/openai/whisper-tiny)                       |
89	| openai/whisper-base                          | Automatic Speech Recognition | [Hugging Face](https://huggingface.co/openai/whisper-base)                       |
90	| microsoft/speecht5_tts                       | Text-To-Speech               | [Hugging Face](https://huggingface.co/microsoft/speecht5_tts)                    |
91
92
93	> **Licensing:** Before setting up and starting the application, review the license terms for each model above and ensure your intended use complies with those licenses.
94
95	> **Note:** Models will be downloaded from their respective sources (Hugging Face, Ultralytics, etc.). You can update the `HF_ENDPOINT` variable in the `.env` file to use a different Hugging Face endpoint if needed.
96
97	---
98
99	#### 2. Hugging Face Model ID
100
101	Specify a Hugging Face model repository ID to download and use models directly from Hugging Face.
102
103	- For models requiring authentication, set your Hugging Face access token using one of the following methods:
104
105	  **Method 1 (Recommended): Update the frontend/.env file**
106
107	    Add or update the `HF_TOKEN` variable in the `frontend/.env` file:
108
109	    ```
110	    HF_TOKEN=your_huggingface_token
111	    ```
112
113	    **Method 2: Export as environment variable**
114
115	    Set the token as an environment variable before starting the application:
116
117	    **For Linux:**
118	    ```bash
119	    export HF_TOKEN='your_huggingface_token'
120	    ```
121
122	    **For Windows:**
123	    ```cmd
124	    set HF_TOKEN=your_huggingface_token
125	    ```
126
127	    Replace `your_huggingface_token` with your actual token from Hugging Face account settings.
128
129	- By default, `HF_ENDPOINT` is set to `https://huggingface.co`. You can configure a custom endpoint by updating the environment variable:
130
131	  **Method 1 (Recommended): Update the frontend/.env file**
132
133	    Add or update the `HF_ENDPOINT` variable in the `frontend/.env` file:
134
135	    ```
136	    HF_ENDPOINT=https://your-custom-endpoint.com
137	    ```
138
139	  **Method 2: Export as environment variable**
140
141	    Set the endpoint as an environment variable before starting the application:
142
143	    **For Linux:**
144	    ```bash
145	    export HF_ENDPOINT='https://your-custom-endpoint.com'
146	    ```
147
148	    **For Windows:**
149	    ```cmd
150	    set HF_ENDPOINT=https://your-custom-endpoint.com
151	    ```
152
153	> **Note:** Some models may not be supported by the libraries or accelerators used in this application.
154
155	---
156
157	#### 3. ModelScope Model ID
158
159	Specify a ModelScope model repository ID to download and use models directly from ModelScope.
160
161	- By default, `MODELSCOPE_DOMAIN` is set to `https://modelscope.cn`. You can configure a custom endpoint by updating the environment variable:
162
163	  **Method 1 (Recommended): Update the frontend/.env file**
164
165	    Add or update the `MODELSCOPE_DOMAIN` variable in the `frontend/.env` file:
166
167	    ```
168	    MODELSCOPE_DOMAIN=https://your-custom-endpoint.com
169	    ```
170
171	  **Method 2: Export as environment variable**
172
173	    Set the endpoint as an environment variable before starting the application:
174
175	    **For Linux:**
176	    ```bash
177	    export MODELSCOPE_DOMAIN='https://your-custom-endpoint.com'
178	    ```
179
180	    **For Windows:**
181	    ```cmd
182	    set MODELSCOPE_DOMAIN=https://your-custom-endpoint.com
183	    ```
184
185	> **Note:** Some models may not be supported by the libraries or accelerators used in this application.
186
187	---
188
189	#### 4. Upload Model ZIP
190
191	Upload your own custom model as a ZIP file.
192
193	- The ZIP must contain all necessary model files in OpenVINO IR format (e.g., `.xml`, `.bin`, and optionally `labels.txt` for object detection).
194	- If your model requires custom processing (e.g., instance segmentation), you may optionally include a `model_proc.json` file with the appropriate configuration.
195
196	  ```
197	  my-model.zip
198	  ├── model.xml
199	  ├── model.bin
200	  └── labels.txt   # (optional)
201	  ```
202
203	- Only OpenVINO models are supported. Ensure your model is exported to OpenVINO IR format before uploading.
204
205	> **Note:** Some workloads may fail if the model is not compatible with the application's supported libraries or accelerators.
206
207	---
208
209	#### 5. Custom Model Directory
210
211	Place your custom model files in the `./custom_models/` directory as described in [custom_models/README.md](./custom_models/README.md):
212
213	- Each model should be placed in its own subdirectory under custom_models, containing all required files in OpenVINO IR format (e.g., `.xml`, `.bin`). Optionally, include `labels.txt` for object detection and `model_proc.json` for instance segmentation that require custom processing.
214	- The application will automatically detect and list models found in this directory.
215	- For details, refer to [custom_models/README.md](./custom_models/README.md).
216
217	> **Note:** Only OpenVINO IR models are supported in the custom model directory. Ensure your model files are correctly structured and compatible.
218
219
220
221	## Quick Start
222
223	This section provides a streamlined process for setting up and running the Edge AI Sizing Tool on your local or isolated system. Follow these steps to quickly configure the environment and launch the application, allowing you to explore its features and capabilities with minimal setup.
224
225	### For Linux:
226
227	#### 1. Setup Platform
228
229	Follow the [Edge Developer Kit Reference Scripts](https://github.com/intel/edge-developer-kit-reference-scripts) to install drivers and configure your system.
230
231	#### 2. Install Dependencies
232
233	```bash
234	sudo ./install.sh
235	```
236
237	This installs all required packages, sets up Python and Node.js environments.
238
239	> **Note:** The first time you run the installation script, the process may take several minutes to complete. Installation time depends on your system configuration and internet speed.
240
241	#### 3. Run the Application
242
243	- Run `./start.sh` to start services either from a fresh state or restart them if already running.
244
245
246	> **Configuration:** When you execute `start.sh`, if `.env` does not contain a `PAYLOAD_SECRET`, the setup will generate a random `PAYLOAD_SECRET` and write it to `.env`. To supply your own secret instead, copy `.env.example` to `.env` and set the `PAYLOAD_SECRET` value before running the script.
247
248	> You can also update the `HF_TOKEN`, `HF_ENDPOINT`, and `MODELSCOPE_DOMAIN` variables in the `.env` file as needed for your environment.
249
250	```bash
251	./start.sh
252	```
253
254	Once started, open http://localhost:8080 in your browser.
255
256	#### 4. Stop the Application
257
258	To stop the application gracefully:
259
260	```bash
261	./stop.sh
262	```
263
264	This script ensures that all services are properly shut down, including background workers.
265
266	### For Windows:
267
268	#### 1. Setup Platform
269
270	If your system has a GPU, install the [GPU driver](https://www.intel.com/content/www/us/en/download/785597/intel-arc-iris-xe-graphics-windows.html).
271	If your system has an NPU, install the [NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html).
272
273	#### 2. Install Dependencies
274
275	Right-click the `install.bat` file and click "Run as administrator".
276
277	This installs all required packages, sets up Python and Node.js environments.
278
279	> **Note:** The first time you run the installation script, the process may take several minutes to complete. Installation time depends on your system configuration and internet speed.
280
281	#### 3. Run the Application
282
283	- Double-click the `start.bat` shortcut on your Desktop to start services either from a fresh state or restore their previous states.
284
285
286	> **Configuration:** When you execute `start.bat`, if `.env` does not contain a `PAYLOAD_SECRET`, the setup will generate a random `PAYLOAD_SECRET` and write it to `.env`. To supply your own secret instead, copy `.env.example` to `.env` and set the `PAYLOAD_SECRET` value before running the script.
287
288	> You can also update the `HF_TOKEN`, `HF_ENDPOINT`, and `MODELSCOPE_DOMAIN` variables in the `.env` file as needed for your environment.
289
290	Once started, open http://localhost:8080 in your browser.
291
292	#### 4. Stop the Application
293
294	To stop the application gracefully:
295
296	Double-click the `stop.bat` shortcut on your Desktop.
297
298	This script ensures that all services are properly shut down, including background workers.
299
300	## Deployment
301
302	Please refer to [DEPLOYMENT.md](DEPLOYMENT.md) for detailed steps on preparing and deploying the application.
303
304	## Development
305
306	Please refer to [DEVELOPMENT.md](DEVELOPMENT.md) for detailed steps on setting up a development environment.
307
308	## Custom Application Profiling
309
310	The Edge AI Sizing Tool includes a Custom Application Profiling feature that allows you to monitor and analyze the performance of your own applications. This tool provides comprehensive resource utilization metrics across CPU, GPU, NPU, memory, and disk I/O, along with automatic bottleneck detection and optimization recommendations.
311
312	Please refer to [CUSTOM_APPLICATION_PROFILING.md](docs/CUSTOM_APPLICATION_PROFILING.md) for:
313	- Step-by-step profiling guide
314	- Understanding performance metrics
315	- Bottleneck analysis and optimization tips
316
317	## Troubleshooting
318
319	### 1. GPU Utilization Not Showing Up
320
321	Follow the steps below to enable the functionality of perf_events for non-root users.
322
323	> **Note:** Only relevant for Linux systems.
324
325	> **Security guidance:** Changing `kernel.perf_event_paranoid=0` expands access to performance monitoring features and can expose system information. Assess the security implications and apply appropriate access controls before making this change.
326
327	#### Temporary Enablement
328
329	To temporarily enable the available functionality of perf_events for non-root users, execute the following command:
330
331	```bash
332	sudo sysctl kernel.perf_event_paranoid=0
333	```
334
335	This command will adjust the kernel parameter for the current session. Note that this change will be reverted upon system reboot.
336
337	#### Permanent Enablement
338
339	To permanently enable perf_events for non-root users, you need to modify the system configuration file. Follow these steps:
340
341	#### 1. **Open the /etc/sysctl.conf file in a text editor with root privileges. You can use nano, vim, or any other editor of your choice:**
342
343	```bash
344	sudo nano /etc/sysctl.conf
345	```
346
347	#### 2. **Add the following line to the file:**
348
349	`kernel.perf_event_paranoid=0`
350
351	#### 3. **Save the changes and exit the editor.**
352
353	Apply the changes by running:
354
355	```bash
356	sudo sysctl -p
357	```
358
359	This will ensure that the perf_events functionality remains enabled across system reboots.
360
361	### 2. Tool Crashes or Stops Unexpectedly
362
363	If you experience frequent crashes or the tool stops working unexpectedly, try enabling Resizable BAR first under BIOS setting.
364
365	#### Enable Resizable BAR
366
367	#### 1. **Enter BIOS/UEFI Setup**:
368	Restart your computer. Press the appropriate key during startup to enter BIOS menu (usually F2, DEL, F10, or F12, depending on your motherboard)
369
370	#### 2. **Enable Resizable BAR Setting**:
371	Look for settings related to "Resizable BAR" or "Re-Size BAR Support". These settings are typically found under sections like "Advanced","PCI Subsystem Settings" or "PCI Configuration". Set the option to "Enabled" for Resizable Bar.
372
373	#### 3. **Save and Exit**:
374	Save your changes and exit BIOS. Your system will restart with Resizable BAR enabled.
375
376	### 3. Installation Script Dependency Issues
377
378	If the installation script encounters dependency conflicts during Intel® XPU Manager installation and returns an `apt --fix-broken install` error, follow the steps below:
379
380	> **Note:** Only relevant for Linux systems.
381
382	#### 1. **Resolve Package Dependencies**
383
384	Execute the following command to address broken package dependencies:
385
386	```bash
387	sudo apt --fix-broken install
388	```
389
390	#### 2. **Retry Installation Process**
391
392	After successfully resolving the dependency issues, re-execute the installation script:
393
394	```bash
395	./install.sh
396	```
397
398	This procedure addresses common package dependency conflicts encountered on Ubuntu systems, particularly during Intel® XPU Manager installation.
399
400	## Limitations
401
402	1. iGPU utilization and device name may not be displayed on Intel® Core™ Ultra 9 288V processors.
403
404	2. On Ubuntu, the Object Detection inferencing stream window may stop displaying results after running for extended periods.
405
406	3. System Overview and System Monitor may only show the PCI ID (e.g., e20b) for certain GPU models instead of the actual descriptive name.
407
408	4. Text generation may produce gibberish and illogical output for some LLM models when using Intel® Arc™ Ultra 7 Processor 155H iGPUs.
409
410	5. DLStreamer is not supported on Windows. Hence, the Object Detection and Instance Segmentation use cases for Computer Vision task are currently unavailable on Windows.
411
412	## Licensing
413	The Edge AI Sizing Tool and its components is licensed under the [APACHE 2.0](./LICENSE.txt) license, except for the following components:
414
415	| Component | License |
416	|:----------|:--------|
417	| GStreamer | [LGPL](https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/licensing.html) |
418
419	## Contributing
420
421	Contributions are welcome and appreciated! Whether it's a bug report, a feature suggestion, documentation improvement, or a code change, your input helps make this project better. Check our [Contributing Guide](./CONTRIBUTING.md) to get started.
422
423	For bugs or suggestions, please open an issue and include relevant details such as your hardware, operating system, reproduction steps, and any error output. This application has been validated on the hardware listed in the documentation; behavior on other configurations may vary.
424

# Edge AI Sizing Tool

The Edge AI Sizing Tool showcases the scalability and performance of AI use cases on Intel-based edge devices. With zero-code configuration, users can effortlessly set up AI applications by selecting inputs, accelerators, performance modes, and AI models. The tool provides real-time monitoring of system performance metrics, such as CPU and GPU usage, memory consumption, and inference speed, enabling users to optimize AI workflows and make informed decisions.

![demo](./docs/demo.gif)

> **Usage guidance:** This software is provided for evaluation and demonstration on a single, trusted machine. It has not been validated for production deployments—if you intend to use it in other environments, perform appropriate testing and security reviews for your target deployment.

## Table of Contents

- [Requirements](#requirements)
  - [Hardware Prerequisites](#hardware-prerequisites)
  - [Software Prerequisites](#software-prerequisites)
  - [Application Ports](#application-ports)
- [Supported AI Models](#supported-ai-models)
  - [1. Predefined Models](#1-predefined-models)
  - [2. Hugging Face Model ID](#2-hugging-face-model-id)
  - [3. ModelScope Model ID](#3-modelscope-model-id)
  - [4. Upload Model ZIP](#4-upload-model-zip)
  - [5. Custom Model Directory](#5-custom-model-directory)
- [Quick Start](#quick-start)
  - [For Linux](#for-linux)
  - [For Windows](#for-windows)
- [Deployment](#deployment)
- [Development](#development)
- [Custom Application Profiling](#custom-application-profiling)
- [Troubleshooting](#troubleshooting)
  - [1. GPU Utilization Not Showing Up](#1-gpu-utilization-not-showing-up)
  - [2. Tool Crashes or Stops Unexpectedly](#2-tool-crashes-or-stops-unexpectedly)
  - [3. Installation Script Dependency Issues](#3-installation-script-dependency-issues)
- [Limitations](#limitations)
- [Licensing](#licensing)
- [Contributing](#contributing)

## Requirements

### Hardware Prerequisites

- CPU: Intel® Core™ Ultra Processor (Products formerly Meteor Lake-UH) and above
- GPU:
  - Intel® Arc™ Graphics (iGPU)
  - Intel® Arc™ A770 Graphics (dGPU)
- RAM: 64GB
- DISK: 256GB+

### Software Prerequisites

- Operating system:
  - Linux: Ubuntu\* 24.04 LTS Desktop
  - Windows: Windows\* 11
- Python version: 3.10+
- Node.js version: 22+
- Intel GPU drivers version: 25.09.32961.5
- Intel NPU drivers version: v1.13.0
- Ubuntu intel-gpu-tools package version: 1.28-1ubuntu2

### Application Ports

Please ensure that these ports are available before running the application.

| Services        | Port      |
| --------------- | --------- |
| Frontend        | 8080      |
| Worker services | 5000-6000 |

### Supported AI Models

The Edge AI Sizing Tool supports the following types of AI models:

#### 1. Predefined Models

A curated set of popular models for common AI tasks:

| Model Name                                   | Task Type                    | Source / License Information                                                     |
|----------------------------------------------|------------------------------|----------------------------------------------------------------------------------|
| YOLOv8                                       | Object Detection             | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
| YOLOv11                                      | Object Detection             | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
| YOLOv8-seg                                   | Instance Segmentation        | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
| YOLOv11-seg                                  | Instance Segmentation        | [Ultralytics Docs](https://docs.ultralytics.com/)                                |
| mask_rcnn_resnet50_atrous_coco               | Instance Segmentation        | [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/mask_rcnn_resnet50_atrous_coco)
| mask_rcnn_inception_resnet_v2_atrous_coco    | Instance Segmentation        | [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/faster_rcnn_inception_resnet_v2_atrous_coco)
| dreamlike-art/dreamlike-anime-1.0            | Text-To-Image                | [Hugging Face](https://huggingface.co/dreamlike-art/dreamlike-anime-1.0)         |
| TinyLlama/TinyLlama-1.1B-Chat-v1.0           | Text Generation              | [Hugging Face](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)        |
| Qwen/Qwen1.5-7B-Chat                         | Text Generation              | [Hugging Face](https://huggingface.co/Qwen/Qwen1.5-7B-Chat)                      |
| OpenVINO/Mistral-7B-Instruct-v0.2-int4-ov    | Text Generation              | [Hugging Face](https://huggingface.co/OpenVINO/Mistral-7B-Instruct-v0.2-int4-ov) |
| OpenVINO/Phi-3-mini-4k-instruct-int4-ov      | Text Generation              | [Hugging Face](https://huggingface.co/OpenVINO/Phi-3-mini-4k-instruct-int4-ov)   |
| openai/whisper-tiny                          | Automatic Speech Recognition | [Hugging Face](https://huggingface.co/openai/whisper-tiny)                       |
| openai/whisper-base                          | Automatic Speech Recognition | [Hugging Face](https://huggingface.co/openai/whisper-base)                       |
| microsoft/speecht5_tts                       | Text-To-Speech               | [Hugging Face](https://huggingface.co/microsoft/speecht5_tts)                    |

> **Licensing:** Before setting up and starting the application, review the license terms for each model above and ensure your intended use complies with those licenses.

> **Note:** Models will be downloaded from their respective sources (Hugging Face, Ultralytics, etc.). You can update the `HF_ENDPOINT` variable in the `.env` file to use a different Hugging Face endpoint if needed.

---

#### 2. Hugging Face Model ID

Specify a Hugging Face model repository ID to download and use models directly from Hugging Face.

- For models requiring authentication, set your Hugging Face access token using one of the following methods:

  **Method 1 (Recommended): Update the frontend/.env file**

    Add or update the `HF_TOKEN` variable in the `frontend/.env` file:

    ```
    HF_TOKEN=your_huggingface_token
    ```

    **Method 2: Export as environment variable**

    Set the token as an environment variable before starting the application:

    **For Linux:**
    ```bash
    export HF_TOKEN='your_huggingface_token'
    ```

    **For Windows:**
    ```cmd
    set HF_TOKEN=your_huggingface_token
    ```

    Replace `your_huggingface_token` with your actual token from Hugging Face account settings.

- By default, `HF_ENDPOINT` is set to `https://huggingface.co`. You can configure a custom endpoint by updating the environment variable:

  **Method 1 (Recommended): Update the frontend/.env file**

    Add or update the `HF_ENDPOINT` variable in the `frontend/.env` file:

    ```
    HF_ENDPOINT=https://your-custom-endpoint.com
    ```

  **Method 2: Export as environment variable**

    Set the endpoint as an environment variable before starting the application:

    **For Linux:**
    ```bash
    export HF_ENDPOINT='https://your-custom-endpoint.com'
    ```

    **For Windows:**
    ```cmd
    set HF_ENDPOINT=https://your-custom-endpoint.com
    ```

> **Note:** Some models may not be supported by the libraries or accelerators used in this application.

---

#### 3. ModelScope Model ID

Specify a ModelScope model repository ID to download and use models directly from ModelScope.

- By default, `MODELSCOPE_DOMAIN` is set to `https://modelscope.cn`. You can configure a custom endpoint by updating the environment variable:

  **Method 1 (Recommended): Update the frontend/.env file**

    Add or update the `MODELSCOPE_DOMAIN` variable in the `frontend/.env` file:

    ```
    MODELSCOPE_DOMAIN=https://your-custom-endpoint.com
    ```

  **Method 2: Export as environment variable**

    Set the endpoint as an environment variable before starting the application:

    **For Linux:**
    ```bash
    export MODELSCOPE_DOMAIN='https://your-custom-endpoint.com'
    ```

    **For Windows:**
    ```cmd
    set MODELSCOPE_DOMAIN=https://your-custom-endpoint.com
    ```

> **Note:** Some models may not be supported by the libraries or accelerators used in this application.

---

#### 4. Upload Model ZIP

Upload your own custom model as a ZIP file.

- The ZIP must contain all necessary model files in OpenVINO IR format (e.g., `.xml`, `.bin`, and optionally `labels.txt` for object detection).
- If your model requires custom processing (e.g., instance segmentation), you may optionally include a `model_proc.json` file with the appropriate configuration.

  ```
  my-model.zip
  ├── model.xml
  ├── model.bin
  └── labels.txt   # (optional)
  ```

- Only OpenVINO models are supported. Ensure your model is exported to OpenVINO IR format before uploading.

> **Note:** Some workloads may fail if the model is not compatible with the application's supported libraries or accelerators.

---

#### 5. Custom Model Directory

Place your custom model files in the `./custom_models/` directory as described in [custom_models/README.md](./custom_models/README.md):

- Each model should be placed in its own subdirectory under custom_models, containing all required files in OpenVINO IR format (e.g., `.xml`, `.bin`). Optionally, include `labels.txt` for object detection and `model_proc.json` for instance segmentation that require custom processing.
- The application will automatically detect and list models found in this directory.
- For details, refer to [custom_models/README.md](./custom_models/README.md).

> **Note:** Only OpenVINO IR models are supported in the custom model directory. Ensure your model files are correctly structured and compatible.

## Quick Start

This section provides a streamlined process for setting up and running the Edge AI Sizing Tool on your local or isolated system. Follow these steps to quickly configure the environment and launch the application, allowing you to explore its features and capabilities with minimal setup.

### For Linux:

#### 1. Setup Platform

Follow the [Edge Developer Kit Reference Scripts](https://github.com/intel/edge-developer-kit-reference-scripts) to install drivers and configure your system.

#### 2. Install Dependencies

```bash
sudo ./install.sh
```

This installs all required packages, sets up Python and Node.js environments.

> **Note:** The first time you run the installation script, the process may take several minutes to complete. Installation time depends on your system configuration and internet speed.

#### 3. Run the Application

- Run `./start.sh` to start services either from a fresh state or restart them if already running.

> **Configuration:** When you execute `start.sh`, if `.env` does not contain a `PAYLOAD_SECRET`, the setup will generate a random `PAYLOAD_SECRET` and write it to `.env`. To supply your own secret instead, copy `.env.example` to `.env` and set the `PAYLOAD_SECRET` value before running the script.

> You can also update the `HF_TOKEN`, `HF_ENDPOINT`, and `MODELSCOPE_DOMAIN` variables in the `.env` file as needed for your environment.

```bash
./start.sh
```

Once started, open http://localhost:8080 in your browser.

#### 4. Stop the Application

To stop the application gracefully:

```bash
./stop.sh
```

This script ensures that all services are properly shut down, including background workers.

### For Windows:

#### 1. Setup Platform

If your system has a GPU, install the [GPU driver](https://www.intel.com/content/www/us/en/download/785597/intel-arc-iris-xe-graphics-windows.html).
If your system has an NPU, install the [NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html).

#### 2. Install Dependencies

Right-click the `install.bat` file and click "Run as administrator".

This installs all required packages, sets up Python and Node.js environments.

> **Note:** The first time you run the installation script, the process may take several minutes to complete. Installation time depends on your system configuration and internet speed.

#### 3. Run the Application

- Double-click the `start.bat` shortcut on your Desktop to start services either from a fresh state or restore their previous states.

> **Configuration:** When you execute `start.bat`, if `.env` does not contain a `PAYLOAD_SECRET`, the setup will generate a random `PAYLOAD_SECRET` and write it to `.env`. To supply your own secret instead, copy `.env.example` to `.env` and set the `PAYLOAD_SECRET` value before running the script.

> You can also update the `HF_TOKEN`, `HF_ENDPOINT`, and `MODELSCOPE_DOMAIN` variables in the `.env` file as needed for your environment.

Once started, open http://localhost:8080 in your browser.

#### 4. Stop the Application

To stop the application gracefully:

Double-click the `stop.bat` shortcut on your Desktop.

This script ensures that all services are properly shut down, including background workers.

## Deployment

Please refer to [DEPLOYMENT.md](DEPLOYMENT.md) for detailed steps on preparing and deploying the application.

## Development

Please refer to [DEVELOPMENT.md](DEVELOPMENT.md) for detailed steps on setting up a development environment.

## Custom Application Profiling

The Edge AI Sizing Tool includes a Custom Application Profiling feature that allows you to monitor and analyze the performance of your own applications. This tool provides comprehensive resource utilization metrics across CPU, GPU, NPU, memory, and disk I/O, along with automatic bottleneck detection and optimization recommendations.

Please refer to [CUSTOM_APPLICATION_PROFILING.md](docs/CUSTOM_APPLICATION_PROFILING.md) for:
- Step-by-step profiling guide
- Understanding performance metrics
- Bottleneck analysis and optimization tips

## Troubleshooting

### 1. GPU Utilization Not Showing Up

Follow the steps below to enable the functionality of perf_events for non-root users.

> **Note:** Only relevant for Linux systems.

> **Security guidance:** Changing `kernel.perf_event_paranoid=0` expands access to performance monitoring features and can expose system information. Assess the security implications and apply appropriate access controls before making this change.

#### Temporary Enablement

To temporarily enable the available functionality of perf_events for non-root users, execute the following command:

```bash
sudo sysctl kernel.perf_event_paranoid=0
```

This command will adjust the kernel parameter for the current session. Note that this change will be reverted upon system reboot.

#### Permanent Enablement

To permanently enable perf_events for non-root users, you need to modify the system configuration file. Follow these steps:

#### 1. **Open the /etc/sysctl.conf file in a text editor with root privileges. You can use nano, vim, or any other editor of your choice:**

```bash
sudo nano /etc/sysctl.conf
```

#### 2. **Add the following line to the file:**

`kernel.perf_event_paranoid=0`

#### 3. **Save the changes and exit the editor.**

Apply the changes by running:

```bash
sudo sysctl -p
```

This will ensure that the perf_events functionality remains enabled across system reboots.

### 2. Tool Crashes or Stops Unexpectedly

If you experience frequent crashes or the tool stops working unexpectedly, try enabling Resizable BAR first under BIOS setting.

#### Enable Resizable BAR

#### 1. **Enter BIOS/UEFI Setup**:
Restart your computer. Press the appropriate key during startup to enter BIOS menu (usually F2, DEL, F10, or F12, depending on your motherboard)

#### 2. **Enable Resizable BAR Setting**:
Look for settings related to "Resizable BAR" or "Re-Size BAR Support". These settings are typically found under sections like "Advanced","PCI Subsystem Settings" or "PCI Configuration". Set the option to "Enabled" for Resizable Bar.

#### 3. **Save and Exit**:
Save your changes and exit BIOS. Your system will restart with Resizable BAR enabled.

### 3. Installation Script Dependency Issues

If the installation script encounters dependency conflicts during Intel® XPU Manager installation and returns an `apt --fix-broken install` error, follow the steps below:

> **Note:** Only relevant for Linux systems.

#### 1. **Resolve Package Dependencies**

Execute the following command to address broken package dependencies:

```bash
sudo apt --fix-broken install
```

#### 2. **Retry Installation Process**

After successfully resolving the dependency issues, re-execute the installation script:

```bash
./install.sh
```

This procedure addresses common package dependency conflicts encountered on Ubuntu systems, particularly during Intel® XPU Manager installation.

## Limitations

1. iGPU utilization and device name may not be displayed on Intel® Core™ Ultra 9 288V processors.

2. On Ubuntu, the Object Detection inferencing stream window may stop displaying results after running for extended periods.

3. System Overview and System Monitor may only show the PCI ID (e.g., e20b) for certain GPU models instead of the actual descriptive name.

4. Text generation may produce gibberish and illogical output for some LLM models when using Intel® Arc™ Ultra 7 Processor 155H iGPUs.

5. DLStreamer is not supported on Windows. Hence, the Object Detection and Instance Segmentation use cases for Computer Vision task are currently unavailable on Windows.

## Licensing
The Edge AI Sizing Tool and its components is licensed under the [APACHE 2.0](./LICENSE.txt) license, except for the following components:

| Component | License |
|:----------|:--------|
| GStreamer | [LGPL](https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/licensing.html) |

## Contributing

Contributions are welcome and appreciated! Whether it's a bug report, a feature suggestion, documentation improvement, or a code change, your input helps make this project better. Check our [Contributing Guide](./CONTRIBUTING.md) to get started.

For bugs or suggestions, please open an issue and include relevant details such as your hardware, operating system, reproduction steps, and any error output. This application has been validated on the hardware listed in the documentation; behavior on other configurations may vary.


1	@echo off
2
3	REM Copyright (C) 2025 Intel Corporation
4	REM SPDX-License-Identifier: Apache-2.0
5
6	setlocal
7
8	REM Check for administrative privileges
9	echo Checking for administrative privileges
10	:checkPrivileges
11	NET SESSION >nul 2>&1
12	if %errorlevel% neq 0 (
13	    echo This script requires administrative privileges. Please run as administrator.
14	    pause
15	    exit /b
16	)
17
18	REM Get the directory of this script (repo root)
19	set "REPO_ROOT=%~dp0"
20	REM Remove trailing backslash if present
21	if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%"
22
23	REM Set thirdparty directory
24	set "THIRDPARTY=%REPO_ROOT%\thirdparty"
25	if not exist "%THIRDPARTY%" mkdir "%THIRDPARTY%"
26
27	set "DESKTOP=%USERPROFILE%\Desktop"
28	set "STARTBAT=%REPO_ROOT%\start.bat"
29	set "STOPBAT=%REPO_ROOT%\stop.bat"
30
31	echo Creating shortcut for start and stop scripts
32	powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%DESKTOP%\start.lnk'); $s.TargetPath = '%STARTBAT%'; $s.Save()"
33	powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%DESKTOP%\stop.lnk'); $s.TargetPath = '%STOPBAT%'; $s.Save()"
34
35	REM Check if winget is installed
36	echo Checking if winget is installed
37	where winget >nul 2>&1
38	if %errorlevel% neq 0 (
39	    setlocal enabledelayedexpansion
40	    echo winget is not installed. Installing winget...
41
42	    REM Download and install dependencies first
43	    echo Downloading winget dependencies package...
44	    set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/latest/download/DesktopAppInstaller_Dependencies.zip"
45	    set "DEPENDENCIES_ZIP=%TEMP%\DesktopAppInstaller_Dependencies.zip"
46	    set "DEPENDENCIES_DIR=%TEMP%\DesktopAppInstaller_Dependencies"
47
48	    REM Clean up any existing dependencies folder
49	    if exist "!DEPENDENCIES_DIR!" (
50	        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
51	    )
52	    mkdir "!DEPENDENCIES_DIR!"
53
54	    echo Downloading dependencies package...
55	    powershell -Command "Invoke-WebRequest -Uri '!DEPENDENCIES_URL!' -OutFile '!DEPENDENCIES_ZIP!' -UseBasicParsing -ErrorAction Stop"
56	    if !errorlevel! neq 0 (
57	        echo Failed to download dependencies package.
58	        echo Press any key to exit...
59	        pause >nul
60	        exit /b
61	    )
62
63	    echo Extracting dependencies package...
64	    powershell -Command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!DEPENDENCIES_DIR!' -Force"
65	    if !errorlevel! neq 0 (
66	        echo Failed to extract dependencies package.
67	        del "!DEPENDENCIES_ZIP!" 2>nul
68	        echo Press any key to exit...
69	        pause >nul
70	        exit /b
71	    )
72
73	    REM Delete the zip file after extraction
74	    del "!DEPENDENCIES_ZIP!" 2>nul
75
76	    echo Installing VCLibs UWPDesktop dependency...
77	    powershell -Command "Add-AppxPackage -Path '!DEPENDENCIES_DIR!\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
78	    if !errorlevel! neq 0 (
79	        echo Warning: Failed to install VCLibs UWPDesktop dependency. Continuing anyway...
80	    )
81
82	    REM Download and install App Installer (winget) from Microsoft
83	    echo Downloading App Installer package...
84	    set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
85	    set "WINGET_INSTALLER=%TEMP%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
86
87	    powershell -Command "Invoke-WebRequest -Uri '!WINGET_URL!' -OutFile '!WINGET_INSTALLER!' -UseBasicParsing -ErrorAction Stop"
88	    if !errorlevel! neq 0 (
89	        echo Failed to download App Installer.
90	        echo Please manually install "App Installer" from the Microsoft Store or from GitHub - Microsoft/winget-cli
91	        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
92	        echo Press any key to exit...
93	        pause >nul
94	        exit /b
95	    )
96
97	    echo Installing App Installer...
98	    powershell -Command "Add-AppxPackage -Path '!WINGET_INSTALLER!'"
99	    if !errorlevel! neq 0 (
100	        echo Failed to install App Installer.
101	        echo Please manually install "App Installer" from the Microsoft Store or from GitHub - Microsoft/winget-cli
102	        del "!WINGET_INSTALLER!" 2>nul
103	        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
104	        echo Press any key to exit...
105	        pause >nul
106	        exit /b
107	    )
108
109	    REM Clean up installers and temp directories
110	    del "!WINGET_INSTALLER!" 2>nul
111	    rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
112
113	    REM Add winget to PATH if not already present
114	    set "WINGET_PATH=%LOCALAPPDATA%\Microsoft\WindowsApps"
115	    echo %PATH% | find /i "%WINGET_PATH%" >nul
116	    if %errorlevel% neq 0 (
117	        echo Adding winget to PATH...
118	        setx PATH "%PATH%;%WINGET_PATH%"
119	        set "PATH=%PATH%;%WINGET_PATH%"
120	        echo Winget path added to environment variable.
121	    )
122
123	    echo App Installer installed successfully.
124	    echo Verifying winget installation...
125	    where winget >nul 2>&1
126	    if !errorlevel! neq 0 (
127	        echo WARNING: winget still not found in PATH. You may need to restart your terminal.
128	        echo Press any key to exit...
129	        pause >nul
130	        exit /b
131	    )
132	    endlocal
133	)
134
135	REM Update Winget to latest version
136	echo Updating winget to the latest version...
137	winget update winget --accept-source-agreements --accept-package-agreements && (
138	    echo winget updated successfully.
139	) || (
140	    echo Failed to update winget. Update it manually from Microsoft Store or GitHub - Microsoft/winget-cli.
141	    echo Continuing with installation...
142	)
143	winget --version
144
145	REM Check if Python is already installed
146	echo Checking if Python is installed...
147	python --version >nul 2>&1
148	if %errorlevel% equ 0 (
149	    echo Python is already installed.
150	    python --version
151	) else (
152	    echo Installing Python...
153	    winget install --id Python.Python.3.12 --silent --accept-package-agreements --accept-source-agreements && (
154	        echo Python installed successfully.
155	    ) || (
156	        echo Failed to install Python. Check your internet connection.
157	        echo Press any key to exit...
158	        pause >nul
159	        exit /b
160	    )
161	)
162
163	REM Check if Git is already installed in thirdparty
164	echo Checking if Git is installed in thirdparty...
165	if exist "%THIRDPARTY%\git\cmd\git.exe" (
166	    echo Git is already installed in thirdparty.
167	    "%THIRDPARTY%\git\cmd\git.exe" --version
168	) else (
169	    setlocal enabledelayedexpansion
170	    echo Installing Git to thirdparty...
171
172	    REM Set Git download URL
173	    set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.51.0.windows.2/MinGit-2.51.0.2-64-bit.zip"
174	    set "TEMP_ZIP=%TEMP%\git.zip"
175	    set "GIT_DIR=%THIRDPARTY%\git"
176
177	    REM Clean up any existing partial installations
178	    if exist "!GIT_DIR!" (
179	        echo Removing previous Git installation...
180	        rmdir /s /q "!GIT_DIR!" 2>nul
181	    )
182
183	    REM Create git directory
184	    mkdir "!GIT_DIR!"
185
186	    echo Downloading MinGit from GitHub...
187	    powershell -Command "Invoke-WebRequest -Uri '!GIT_URL!' -OutFile '!TEMP_ZIP!' -UseBasicParsing -ErrorAction Stop"
188	    if !errorlevel! neq 0 (
189	        echo Failed to download Git. Check your internet connection.
190	        echo Press any key to exit...
191	        pause >nul
192	        endlocal
193	        exit /b
194	    )
195
196	    echo Download complete. Extracting to thirdparty...
197	    tar -xf "!TEMP_ZIP!" -C "!GIT_DIR!"
198	    if !errorlevel! neq 0 (
199	        echo Failed to extract Git archive.
200	        echo Press any key to exit...
201	        del "!TEMP_ZIP!" 2>nul
202	        pause >nul
203	        endlocal
204	        exit /b
205	    )
206
207	    REM Clean up temp file
208	    del "!TEMP_ZIP!"
209
210	    REM Verify Git installation
211	    if exist "!GIT_DIR!\cmd\git.exe" (
212	        echo Git installed successfully in thirdparty.
213	        "!GIT_DIR!\cmd\git.exe" --version
214	    ) else (
215	        echo ERROR: git.exe not found after extraction.
216	        echo Press any key to exit...
217	        pause >nul
218	        endlocal
219	        exit /b
220	    )
221	    endlocal
222	)
223
224	REM Setup Intel PCM
225	call "%REPO_ROOT%\scripts\setup_pcm.bat" "%REPO_ROOT%" "%THIRDPARTY%"
226
227	REM Check if Node.js is already installed in thirdparty
228	echo Checking if Node.js is installed in thirdparty...
229	if exist "%THIRDPARTY%\nodejs\node.exe" (
230	    echo Node.js is already installed in thirdparty.
231	    "%THIRDPARTY%\nodejs\node.exe" --version
232	) else (
233	    setlocal enabledelayedexpansion
234	    echo Installing Node.js to thirdparty...
235
236	    REM Determine system architecture
237	    if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
238	        set "NODE_ARCH=x64"
239	    ) else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
240	        set "NODE_ARCH=arm64"
241	    ) else (
242	        echo Unsupported architecture: %PROCESSOR_ARCHITECTURE%
243	        echo Press any key to exit...
244	        pause >nul
245	        endlocal
246	        exit /b
247	    )
248
249	    REM Set Node.js LTS version
250	    set "NODE_VERSION=24.10.0"
251	    set "NODE_ZIP=node-v!NODE_VERSION!-win-!NODE_ARCH!.zip"
252	    set "NODE_URL=https://nodejs.org/dist/v!NODE_VERSION!/!NODE_ZIP!"
253	    set "TEMP_ZIP=%TEMP%\!NODE_ZIP!"
254
255	    echo Downloading Node.js v!NODE_VERSION! for !NODE_ARCH! from nodejs.org...
256	    powershell -Command "Invoke-WebRequest -Uri '!NODE_URL!' -OutFile '!TEMP_ZIP!'" && (
257	        echo Download complete. Extracting to thirdparty...
258	        powershell -Command "Expand-Archive -Path '!TEMP_ZIP!' -DestinationPath '%THIRDPARTY%' -Force"
259
260	        REM Rename extracted folder to 'nodejs'
261	        ren "%THIRDPARTY%\node-v!NODE_VERSION!-win-!NODE_ARCH!" nodejs
262
263	        REM Clean up temp file
264	        del "!TEMP_ZIP!"
265
266	        echo Node.js installed successfully in thirdparty.
267	        "%THIRDPARTY%\nodejs\node.exe" --version
268	    ) || (
269	        echo Failed to download or extract Node.js. Check your internet connection.
270	        echo Press any key to exit...
271	        pause >nul
272	        endlocal
273	        exit /b
274	    )
275	    endlocal
276	)
277
278	REM Check if XPU-SMI is already installed in thirdparty
279	echo Checking if XPU-SMI is installed in thirdparty...
280	if not exist "%THIRDPARTY%\xpu-smi\xpu-smi.exe" (
281	    echo Installing XPU-SMI...
282	    curl --create-dirs -L -O --output-dir "%THIRDPARTY%\xpu-smi" https://github.com/intel/xpumanager/releases/download/v1.3.6/xpu-smi-1.3.6-20260206.143316.1004f6cb_win.zip
283	    tar -xf "%THIRDPARTY%\xpu-smi\xpu-smi-1.3.6-20260206.143316.1004f6cb_win.zip" -C "%THIRDPARTY%\xpu-smi" >nul 2>&1
284	)
285
286	REM Check if uv is already installed in thirdparty
287	echo Checking if uv is installed in thirdparty...
288	if exist "%THIRDPARTY%\uv\uv.exe" (
289	    echo uv is already installed in thirdparty.
290	    "%THIRDPARTY%\uv\uv.exe" --version
291	) else (
292	    setlocal enabledelayedexpansion
293	    echo Installing uv to thirdparty...
294
295	    REM Set uv download URL
296	    set "UV_URL=https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip"
297	    set "TEMP_ZIP=%TEMP%\uv.zip"
298	    set "UV_DIR=%THIRDPARTY%\uv"
299
300	    REM Clean up any existing partial installations
301	    if exist "!UV_DIR!" (
302	        echo Removing previous uv installation...
303	        rmdir /s /q "!UV_DIR!" 2>nul
304	    )
305
306	    REM Create uv directory
307	    mkdir "!UV_DIR!"
308
309	    echo Downloading uv from GitHub...
310	    powershell -Command "Invoke-WebRequest -Uri '!UV_URL!' -OutFile '!TEMP_ZIP!' -UseBasicParsing -ErrorAction Stop"
311	    if !errorlevel! neq 0 (
312	        echo Failed to download uv. Check your internet connection.
313	        echo Press any key to exit...
314	        pause >nul
315	        endlocal
316	        exit /b
317	    )
318
319	    echo Download complete. Extracting to thirdparty...
320	    tar -xf "!TEMP_ZIP!" -C "!UV_DIR!"
321	    if !errorlevel! neq 0 (
322	        echo Failed to extract uv archive.
323	        echo Press any key to exit...
324	        del "!TEMP_ZIP!" 2>nul
325	        pause >nul
326	        endlocal
327	        exit /b
328	    )
329
330	    REM Clean up temp file
331	    del "!TEMP_ZIP!"
332
333	    REM Verify uv installation
334	    if exist "!UV_DIR!\uv.exe" (
335	        echo uv installed successfully in thirdparty.
336	        "!UV_DIR!\uv.exe" --version
337	    ) else (
338	        echo ERROR: uv.exe not found after extraction.
339	        echo Press any key to exit...
340	        pause >nul
341	        endlocal
342	        exit /b
343	    )
344	    endlocal
345	)
346
347	REM Disable path length limit for Python
348	echo Disabling path length limit...
349	set "REG_PATH=HKLM\SYSTEM\CurrentControlSet\Control\FileSystem"
350	set "REG_KEY=LongPathsEnabled"
351	set "REG_VALUE=1"
352
353	REM Check if the registry key exists and set it
354	reg query "%REG_PATH%" /v "%REG_KEY%" >nul 2>&1
355	if %errorlevel%==0 (
356	    reg add "%REG_PATH%" /v "%REG_KEY%" /t REG_DWORD /d %REG_VALUE% /f
357	    echo Path length limit disabled
358	) else (
359	    echo Failed to modify registry. Please check permissions.
360	    pause
361	)
362
363	echo Installation complete.
364
365	REM Enable test signing for the MSR driver
366	echo Enabling test signing for driver installation...
367	bcdedit /set testsigning on
368	echo NOTE: System will need to be rebooted for test signing to take effect.
369	echo Rebooting system in 10 seconds...
370
371	timeout /t 10
372	shutdown /r /t 0
373	endlocal
374

@echo off

REM Copyright (C) 2025 Intel Corporation
REM SPDX-License-Identifier: Apache-2.0

setlocal

REM Check for administrative privileges
echo Checking for administrative privileges
:checkPrivileges
NET SESSION >nul 2>&1
if %errorlevel% neq 0 (
    echo This script requires administrative privileges. Please run as administrator.
    pause
    exit /b
)

REM Get the directory of this script (repo root)
set "REPO_ROOT=%~dp0"
REM Remove trailing backslash if present
if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%"

REM Set thirdparty directory
set "THIRDPARTY=%REPO_ROOT%\thirdparty"
if not exist "%THIRDPARTY%" mkdir "%THIRDPARTY%"

set "DESKTOP=%USERPROFILE%\Desktop"
set "STARTBAT=%REPO_ROOT%\start.bat"
set "STOPBAT=%REPO_ROOT%\stop.bat"

echo Creating shortcut for start and stop scripts
powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%DESKTOP%\start.lnk'); $s.TargetPath = '%STARTBAT%'; $s.Save()"
powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%DESKTOP%\stop.lnk'); $s.TargetPath = '%STOPBAT%'; $s.Save()"

REM Check if winget is installed
echo Checking if winget is installed
where winget >nul 2>&1
if %errorlevel% neq 0 (
    setlocal enabledelayedexpansion
    echo winget is not installed. Installing winget...

    REM Download and install dependencies first
    echo Downloading winget dependencies package...
    set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/latest/download/DesktopAppInstaller_Dependencies.zip"
    set "DEPENDENCIES_ZIP=%TEMP%\DesktopAppInstaller_Dependencies.zip"
    set "DEPENDENCIES_DIR=%TEMP%\DesktopAppInstaller_Dependencies"

    REM Clean up any existing dependencies folder
    if exist "!DEPENDENCIES_DIR!" (
        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
    )
    mkdir "!DEPENDENCIES_DIR!"

    echo Downloading dependencies package...
    powershell -Command "Invoke-WebRequest -Uri '!DEPENDENCIES_URL!' -OutFile '!DEPENDENCIES_ZIP!' -UseBasicParsing -ErrorAction Stop"
    if !errorlevel! neq 0 (
        echo Failed to download dependencies package.
        echo Press any key to exit...
        pause >nul
        exit /b
    )

    echo Extracting dependencies package...
    powershell -Command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!DEPENDENCIES_DIR!' -Force"
    if !errorlevel! neq 0 (
        echo Failed to extract dependencies package.
        del "!DEPENDENCIES_ZIP!" 2>nul
        echo Press any key to exit...
        pause >nul
        exit /b
    )

    REM Delete the zip file after extraction
    del "!DEPENDENCIES_ZIP!" 2>nul

    echo Installing VCLibs UWPDesktop dependency...
    powershell -Command "Add-AppxPackage -Path '!DEPENDENCIES_DIR!\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
    if !errorlevel! neq 0 (
        echo Warning: Failed to install VCLibs UWPDesktop dependency. Continuing anyway...
    )

    REM Download and install App Installer (winget) from Microsoft
    echo Downloading App Installer package...
    set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
    set "WINGET_INSTALLER=%TEMP%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"

    powershell -Command "Invoke-WebRequest -Uri '!WINGET_URL!' -OutFile '!WINGET_INSTALLER!' -UseBasicParsing -ErrorAction Stop"
    if !errorlevel! neq 0 (
        echo Failed to download App Installer.
        echo Please manually install "App Installer" from the Microsoft Store or from GitHub - Microsoft/winget-cli
        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
        echo Press any key to exit...
        pause >nul
        exit /b
    )

    echo Installing App Installer...
    powershell -Command "Add-AppxPackage -Path '!WINGET_INSTALLER!'"
    if !errorlevel! neq 0 (
        echo Failed to install App Installer.
        echo Please manually install "App Installer" from the Microsoft Store or from GitHub - Microsoft/winget-cli
        del "!WINGET_INSTALLER!" 2>nul
        rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul
        echo Press any key to exit...
        pause >nul
        exit /b
    )

    REM Clean up installers and temp directories
    del "!WINGET_INSTALLER!" 2>nul
    rmdir /s /q "!DEPENDENCIES_DIR!" 2>nul

    REM Add winget to PATH if not already present
    set "WINGET_PATH=%LOCALAPPDATA%\Microsoft\WindowsApps"
    echo %PATH% | find /i "%WINGET_PATH%" >nul
    if %errorlevel% neq 0 (
        echo Adding winget to PATH...
        setx PATH "%PATH%;%WINGET_PATH%"
        set "PATH=%PATH%;%WINGET_PATH%"
        echo Winget path added to environment variable.
    )

    echo App Installer installed successfully.
    echo Verifying winget installation...
    where winget >nul 2>&1
    if !errorlevel! neq 0 (
        echo WARNING: winget still not found in PATH. You may need to restart your terminal.
        echo Press any key to exit...
        pause >nul
        exit /b
    )
    endlocal
)

REM Update Winget to latest version
echo Updating winget to the latest version...
winget update winget --accept-source-agreements --accept-package-agreements && (
    echo winget updated successfully.
) || (
    echo Failed to update winget. Update it manually from Microsoft Store or GitHub - Microsoft/winget-cli.
    echo Continuing with installation...
)
winget --version

REM Check if Python is already installed
echo Checking if Python is installed...
python --version >nul 2>&1
if %errorlevel% equ 0 (
    echo Python is already installed.
    python --version
) else (
    echo Installing Python...
    winget install --id Python.Python.3.12 --silent --accept-package-agreements --accept-source-agreements && (
        echo Python installed successfully.
    ) || (
        echo Failed to install Python. Check your internet connection.
        echo Press any key to exit...
        pause >nul
        exit /b
    )
)

REM Check if Git is already installed in thirdparty
echo Checking if Git is installed in thirdparty...
if exist "%THIRDPARTY%\git\cmd\git.exe" (
    echo Git is already installed in thirdparty.
    "%THIRDPARTY%\git\cmd\git.exe" --version
) else (
    setlocal enabledelayedexpansion
    echo Installing Git to thirdparty...

    REM Set Git download URL
    set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.51.0.windows.2/MinGit-2.51.0.2-64-bit.zip"
    set "TEMP_ZIP=%TEMP%\git.zip"
    set "GIT_DIR=%THIRDPARTY%\git"

    REM Clean up any existing partial installations
    if exist "!GIT_DIR!" (
        echo Removing previous Git installation...
        rmdir /s /q "!GIT_DIR!" 2>nul
    )

    REM Create git directory
    mkdir "!GIT_DIR!"

    echo Downloading MinGit from GitHub...
    powershell -Command "Invoke-WebRequest -Uri '!GIT_URL!' -OutFile '!TEMP_ZIP!' -UseBasicParsing -ErrorAction Stop"
    if !errorlevel! neq 0 (
        echo Failed to download Git. Check your internet connection.
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )

    echo Download complete. Extracting to thirdparty...
    tar -xf "!TEMP_ZIP!" -C "!GIT_DIR!"
    if !errorlevel! neq 0 (
        echo Failed to extract Git archive.
        echo Press any key to exit...
        del "!TEMP_ZIP!" 2>nul
        pause >nul
        endlocal
        exit /b
    )

    REM Clean up temp file
    del "!TEMP_ZIP!"

    REM Verify Git installation
    if exist "!GIT_DIR!\cmd\git.exe" (
        echo Git installed successfully in thirdparty.
        "!GIT_DIR!\cmd\git.exe" --version
    ) else (
        echo ERROR: git.exe not found after extraction.
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )
    endlocal
)

REM Setup Intel PCM
call "%REPO_ROOT%\scripts\setup_pcm.bat" "%REPO_ROOT%" "%THIRDPARTY%"

REM Check if Node.js is already installed in thirdparty
echo Checking if Node.js is installed in thirdparty...
if exist "%THIRDPARTY%\nodejs\node.exe" (
    echo Node.js is already installed in thirdparty.
    "%THIRDPARTY%\nodejs\node.exe" --version
) else (
    setlocal enabledelayedexpansion
    echo Installing Node.js to thirdparty...

    REM Determine system architecture
    if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
        set "NODE_ARCH=x64"
    ) else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
        set "NODE_ARCH=arm64"
    ) else (
        echo Unsupported architecture: %PROCESSOR_ARCHITECTURE%
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )

    REM Set Node.js LTS version
    set "NODE_VERSION=24.10.0"
    set "NODE_ZIP=node-v!NODE_VERSION!-win-!NODE_ARCH!.zip"
    set "NODE_URL=https://nodejs.org/dist/v!NODE_VERSION!/!NODE_ZIP!"
    set "TEMP_ZIP=%TEMP%\!NODE_ZIP!"

    echo Downloading Node.js v!NODE_VERSION! for !NODE_ARCH! from nodejs.org...
    powershell -Command "Invoke-WebRequest -Uri '!NODE_URL!' -OutFile '!TEMP_ZIP!'" && (
        echo Download complete. Extracting to thirdparty...
        powershell -Command "Expand-Archive -Path '!TEMP_ZIP!' -DestinationPath '%THIRDPARTY%' -Force"

        REM Rename extracted folder to 'nodejs'
        ren "%THIRDPARTY%\node-v!NODE_VERSION!-win-!NODE_ARCH!" nodejs

        REM Clean up temp file
        del "!TEMP_ZIP!"

        echo Node.js installed successfully in thirdparty.
        "%THIRDPARTY%\nodejs\node.exe" --version
    ) || (
        echo Failed to download or extract Node.js. Check your internet connection.
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )
    endlocal
)

REM Check if XPU-SMI is already installed in thirdparty
echo Checking if XPU-SMI is installed in thirdparty...
if not exist "%THIRDPARTY%\xpu-smi\xpu-smi.exe" (
    echo Installing XPU-SMI...
    curl --create-dirs -L -O --output-dir "%THIRDPARTY%\xpu-smi" https://github.com/intel/xpumanager/releases/download/v1.3.6/xpu-smi-1.3.6-20260206.143316.1004f6cb_win.zip
    tar -xf "%THIRDPARTY%\xpu-smi\xpu-smi-1.3.6-20260206.143316.1004f6cb_win.zip" -C "%THIRDPARTY%\xpu-smi" >nul 2>&1
)

REM Check if uv is already installed in thirdparty
echo Checking if uv is installed in thirdparty...
if exist "%THIRDPARTY%\uv\uv.exe" (
    echo uv is already installed in thirdparty.
    "%THIRDPARTY%\uv\uv.exe" --version
) else (
    setlocal enabledelayedexpansion
    echo Installing uv to thirdparty...

    REM Set uv download URL
    set "UV_URL=https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip"
    set "TEMP_ZIP=%TEMP%\uv.zip"
    set "UV_DIR=%THIRDPARTY%\uv"

    REM Clean up any existing partial installations
    if exist "!UV_DIR!" (
        echo Removing previous uv installation...
        rmdir /s /q "!UV_DIR!" 2>nul
    )

    REM Create uv directory
    mkdir "!UV_DIR!"

    echo Downloading uv from GitHub...
    powershell -Command "Invoke-WebRequest -Uri '!UV_URL!' -OutFile '!TEMP_ZIP!' -UseBasicParsing -ErrorAction Stop"
    if !errorlevel! neq 0 (
        echo Failed to download uv. Check your internet connection.
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )

    echo Download complete. Extracting to thirdparty...
    tar -xf "!TEMP_ZIP!" -C "!UV_DIR!"
    if !errorlevel! neq 0 (
        echo Failed to extract uv archive.
        echo Press any key to exit...
        del "!TEMP_ZIP!" 2>nul
        pause >nul
        endlocal
        exit /b
    )

    REM Clean up temp file
    del "!TEMP_ZIP!"

    REM Verify uv installation
    if exist "!UV_DIR!\uv.exe" (
        echo uv installed successfully in thirdparty.
        "!UV_DIR!\uv.exe" --version
    ) else (
        echo ERROR: uv.exe not found after extraction.
        echo Press any key to exit...
        pause >nul
        endlocal
        exit /b
    )
    endlocal
)

REM Disable path length limit for Python
echo Disabling path length limit...
set "REG_PATH=HKLM\SYSTEM\CurrentControlSet\Control\FileSystem"
set "REG_KEY=LongPathsEnabled"
set "REG_VALUE=1"

REM Check if the registry key exists and set it
reg query "%REG_PATH%" /v "%REG_KEY%" >nul 2>&1
if %errorlevel%==0 (
    reg add "%REG_PATH%" /v "%REG_KEY%" /t REG_DWORD /d %REG_VALUE% /f
    echo Path length limit disabled
) else (
    echo Failed to modify registry. Please check permissions.
    pause
)

echo Installation complete.

REM Enable test signing for the MSR driver
echo Enabling test signing for driver installation...
bcdedit /set testsigning on
echo NOTE: System will need to be rebooted for test signing to take effect.
echo Rebooting system in 10 seconds...

timeout /t 10
shutdown /r /t 0
endlocal


1	@echo off
2
3	REM Copyright (C) 2025 Intel Corporation
4	REM SPDX-License-Identifier: Apache-2.0
5
6	setlocal
7
8	REM Check for administrative privileges
9	echo Checking for administrative privileges
10	:checkPrivileges
11	NET SESSION >nul 2>&1
12	if %errorlevel% neq 0 (
13	    echo This script requires administrative privileges. Please run as administrator.
14	    pause
15	    exit /b
16	)
17
18	REM Get the directory of this script (repo root)
19	set "REPO_ROOT=%~dp0"
20	REM Remove trailing backslash if present
21	if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%"
22
23	REM Prepend thirdparty\nodejs to PATH for portable node/npm
24	set "PATH=%REPO_ROOT%\thirdparty\nodejs;%PATH%"
25
26	REM Set explicit paths to npm and node in thirdparty
27	set "NPM=%REPO_ROOT%\thirdparty\nodejs\npm.cmd"
28	set "NODE=%REPO_ROOT%\thirdparty\nodejs\node.exe"
29
30	REM Set path to PCM sensor server
31	set "PCM_SERVER=%REPO_ROOT%\thirdparty\pcm\pcm-sensor-server.exe"
32
33	REM Check if pcm-sensor-server.exe exists
34	if not exist "%PCM_SERVER%" (
35	    echo WARNING: pcm-sensor-server.exe not found at %PCM_SERVER%
36	    echo Continuing without power monitoring...
37	    timeout /t 3 /nobreak >nul
38	    goto :skipPCM
39	)
40
41	REM Start PCM sensor server in background
42	echo Starting PCM sensor server...
43	start /B "" "%PCM_SERVER%" -r >nul 2>&1
44	if %errorlevel% neq 0 (
45	    echo WARNING: Failed to start pcm-sensor-server.exe
46	    echo This requires administrator privileges.
47	    echo Continuing without power monitoring...
48	    timeout /t 3 /nobreak >nul
49	) else (
50	    echo PCM sensor server started successfully.
51	    REM Wait a moment for server to initialize
52	    timeout /t 3 /nobreak >nul
53	)
54
55	:skipPCM
56
57	REM Navigate to the frontend directory in the repo
58	cd /d "%REPO_ROOT%\frontend"
59	if %errorlevel% neq 0 (
60	    echo Failed to navigate to the 'frontend' directory. Please check if it exists.
61	    echo Press any key to exit...
62	    pause >nul
63	    goto :eof
64	)
65
66	REM Run the demo script using local npm
67	call "%NPM%" run demo && (
68	    echo 'npm run demo' executed successfully.
69	    echo Edge AI Sizing Tool started successfully.
70	    REM Wait a few seconds to ensure the server is up
71	    echo Opening browser automatically in 3 seconds...
72	    timeout /t 3 /nobreak >nul
73
74	    start http://localhost:8080
75	    echo Browser opened.
76	    echo.
77	    timeout /t 3 /nobreak >nul
78
79
80	) || (
81	    echo Failed to run 'npm run demo'. Please ensure npm is installed and configured correctly.
82	    echo Press any key to exit...
83	    pause >nul
84	    goto :eof
85	)
86
87	endlocal

@echo off

REM Copyright (C) 2025 Intel Corporation
REM SPDX-License-Identifier: Apache-2.0

setlocal

REM Check for administrative privileges
echo Checking for administrative privileges
:checkPrivileges
NET SESSION >nul 2>&1
if %errorlevel% neq 0 (
    echo This script requires administrative privileges. Please run as administrator.
    pause
    exit /b
)

REM Get the directory of this script (repo root)
set "REPO_ROOT=%~dp0"
REM Remove trailing backslash if present
if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%"

REM Prepend thirdparty\nodejs to PATH for portable node/npm
set "PATH=%REPO_ROOT%\thirdparty\nodejs;%PATH%"

REM Set explicit paths to npm and node in thirdparty
set "NPM=%REPO_ROOT%\thirdparty\nodejs\npm.cmd"
set "NODE=%REPO_ROOT%\thirdparty\nodejs\node.exe"

REM Set path to PCM sensor server
set "PCM_SERVER=%REPO_ROOT%\thirdparty\pcm\pcm-sensor-server.exe"

REM Check if pcm-sensor-server.exe exists
if not exist "%PCM_SERVER%" (
    echo WARNING: pcm-sensor-server.exe not found at %PCM_SERVER%
    echo Continuing without power monitoring...
    timeout /t 3 /nobreak >nul
    goto :skipPCM
)

REM Start PCM sensor server in background
echo Starting PCM sensor server...
start /B "" "%PCM_SERVER%" -r >nul 2>&1
if %errorlevel% neq 0 (
    echo WARNING: Failed to start pcm-sensor-server.exe
    echo This requires administrator privileges.
    echo Continuing without power monitoring...
    timeout /t 3 /nobreak >nul
) else (
    echo PCM sensor server started successfully.
    REM Wait a moment for server to initialize
    timeout /t 3 /nobreak >nul
)

:skipPCM

REM Navigate to the frontend directory in the repo
cd /d "%REPO_ROOT%\frontend"
if %errorlevel% neq 0 (
    echo Failed to navigate to the 'frontend' directory. Please check if it exists.
    echo Press any key to exit...
    pause >nul
    goto :eof
)

REM Run the demo script using local npm
call "%NPM%" run demo && (
    echo 'npm run demo' executed successfully.
    echo Edge AI Sizing Tool started successfully.
    REM Wait a few seconds to ensure the server is up
    echo Opening browser automatically in 3 seconds...
    timeout /t 3 /nobreak >nul

    start http://localhost:8080
    echo Browser opened.
    echo.
    timeout /t 3 /nobreak >nul

) || (
    echo Failed to run 'npm run demo'. Please ensure npm is installed and configured correctly.
    echo Press any key to exit...
    pause >nul
    goto :eof
)

endlocal


The `install.bat` requires admin privileges and **reboots the system** at the end (line 373). Let me check the custom application profiling docs first — that's the feature we actually need:


1	# Custom Application Profiling
2
3	Monitor and analyze the performance of your applications on Intel hardware platform with CPU, GPU, NPU, memory, and disk I/O metrics.
4
5	> **Note:** This feature is currently supported on Linux OS only.
6
7	## Table of Contents
8
9	- [What It Does](#what-it-does)
10	- [Quick Start](#quick-start)
11	- [Understanding Results](#understanding-results)
12	- [Troubleshooting](#troubleshooting)
13
14	---
15
16	## What It Does
17
18	This tool helps you:
19	- **Monitor resource usage** - See CPU, GPU, NPU, memory, and disk utilization
20	- **Find bottlenecks** - Automatically identifies performance issues
21	- **Get recommendations** - Receive specific optimization suggestions
22	- **Compare performance** - Baseline comparison shows your app's actual impact
23
24	---
25
26	## Quick Start
27
28	### Step 1: Find Your Process ID (PID)
29
30	If your application is already running, find its PID:
31
32	```bash
33	ps aux | grep your_application_name
34	```
35
36	The second column is your PID (e.g., `10054`).
37
38	### Step 2: Set Up Profiling
39
40	1. Open the Edge AI Sizing Tool dashboard
41	2. Click **"Add Workload"** or the **+** icon
42	3. Select **Task**: `Custom Application Monitoring`
43	4. Choose **Process Selection**:
44	   - **PID** (recommended): Enter your process ID (e.g., `10054`)
45	   - **Application Path**: Enter application/process name
46	     - Python application: `python3 /path/to/your_script.py`
47	     - Node.js application: `node /path/to/your_script.js`
48	     - Custom binary: `/path/to/your_program`
49	5. Set **Duration**: 30-300 seconds (60 seconds recommended)
50	6. Click **"Add Workload"**
51
52	**Using Custom Python Environments:**
53
54	If your application requires a specific Python environment (virtual environment, conda, or specific Python version), specify the full path to the Python executable:
55
56	- Virtual environment: `/home/user/myproject/venv/bin/python /home/user/myproject/app.py`
57	- Conda environment: `/home/user/miniconda3/envs/myenv/bin/python /path/to/script.py`
58	- Specific Python version: `/usr/bin/python3.11 /path/to/your_script.py`
59	- With arguments: `/path/to/venv/bin/python script.py --config prod.json`
60
61	### Step 3: Wait for Results
62
63	The profiling takes your specified duration plus 15-20 seconds for processing. You'll see a progress bar with countdown.
64
65	**Don't close your browser during profiling.**
66
67	## Understanding Results
68
69	The dashboard shows comprehensive performance metrics:
70
71	### Performance Status
72
73	Shows overall health of your application with severity level (HEALTHY, WARNING, or CRITICAL) and identifies the primary bottleneck resource if any issues are detected.
74
75	### Key Metrics
76
77	**Baseline**: Shows system resource usage before your app started (should be < 20%)
78
79	**CPU Usage** (0-100% per core)
80	- < 30%: Light usage
81	- 30-70%: Moderate usage
82	- 70-90%: High usage
83	- \> 90%: Bottleneck
84
85	**GPU Usage** (0-100%)
86	- Shows how much of GPU capacity is being used
87	- High usage (>80%) may indicate GPU bottleneck
88
89	**NPU Usage** (Intel® Core™ Ultra processors only)
90	- Neural Processing Unit utilization
91	- Only used by AI models targeting NPU
92
93	**Memory**
94	- Shows RAM and GPU memory consumption
95	- Peak values show maximum usage
96
97	**Disk I/O**
98	- Read/Write throughput in MB/s
99	- High values indicate data-intensive operations
100
101	---
102
103	## Troubleshooting
104
105	### "Please provide a valid PID"
106	- Enter a numeric PID (e.g., `10054`)
107	- Verify process is running: `ps -p 10054`
108
109	### "Process not found"
110	- Check if process is still running: `ps -p <PID>`
111	- Ensure you have permission to monitor it
112	- For short-lived processes, profile the parent process
113
114	### High baseline warning
115	- Close unnecessary applications
116	- Wait for system to stabilize
117	- Background usage affects measurement accuracy
118
119	### All metrics show 0%
120	- Verify PID is correct: `ps -p <PID>`
121	- Check if you have permission to monitor the process
122	- Ensure application is active during profiling
123
124	### GPU shows 0% despite using GPU
125	- Verify GPU drivers: `xpumcli discovery`
126	- Check if application actually uses GPU
127	- See main README for driver installation
128
129
130	---
131
132	## Tips
133
134	**Best Duration Settings:**
135	- Quick check: 30 seconds
136	- Standard profiling: 60 seconds
137	- Comprehensive: 120-300 seconds
138	- Long service: 300-600 seconds
139
140	**For Accurate Results:**
141	- Close background applications before profiling
142	- Use consistent baseline (< 20% CPU/memory)
143	- Profile long enough to capture typical behavior
144	- Run multiple times and compare results
145
146	**Optimization Workflow:**
147	1. Profile to identify bottleneck
148	2. Apply recommended optimizations
149	3. Re-profile to measure improvement
150	4. Repeat for next bottleneck
151
152	---
153
154	## CLI Alternative
155
156	For automation or advanced usage:
157
158	```bash
159	cd workers/custom-application-profiling
160
161	# Check platform status
162	python3 main.py status
163
164	# Profile by PID
165	python3 main.py profile --pid 10054 --name "my_app" --duration 60
166
167	# Save results to JSON
168	python3 main.py profile --pid 10054 --name "my_app" --duration 60 --output results.json
169	```
170
171	### Using Custom Python Environments (CLI)
172
173	When using the CLI, run `main.py` with the profiler's Python environment (which has dependencies installed), while your application can use a different Python environment:
174
175	```bash
176	cd workers/custom-application-profiling
177
178	# Use profiler's venv - application uses same venv
179	venv/bin/python main.py profile --app "venv/bin/python your_app.py" --duration 30
180
181	# Profile app in conda environment
182	venv/bin/python main.py profile \
183	    --app "/home/user/miniconda3/envs/myenv/bin/python app.py" \
184	    --name "my_app" \
185	    --duration 60 \
186	    --output results.json
187	```
188
189	**Note:** If you see `ERROR: psutil module not found`, use the profiler's venv: `venv/bin/python main.py` instead of `python3 main.py`
190
191	---
192
193	## More Information
194
195	- **Intel® VTune™ Profiler**: [software.intel.com/vtune](https://software.intel.com/vtune)
196	- **Intel® OpenVINO™**: [docs.openvino.ai](https://docs.openvino.ai)
197	- **Main README**: [README.md](../README.md)
198
199	---
200
201	## License
202
203	Copyright (C) 2025 Intel Corporation
204	SPDX-License-Identifier: Apache-2.0
205
206

# Custom Application Profiling

Monitor and analyze the performance of your applications on Intel hardware platform with CPU, GPU, NPU, memory, and disk I/O metrics.

> **Note:** This feature is currently supported on Linux OS only.

## Table of Contents

- [What It Does](#what-it-does)
- [Quick Start](#quick-start)
- [Understanding Results](#understanding-results)
- [Troubleshooting](#troubleshooting)

---

## What It Does

This tool helps you:
- **Monitor resource usage** - See CPU, GPU, NPU, memory, and disk utilization
- **Find bottlenecks** - Automatically identifies performance issues
- **Get recommendations** - Receive specific optimization suggestions
- **Compare performance** - Baseline comparison shows your app's actual impact

---

## Quick Start

### Step 1: Find Your Process ID (PID)

If your application is already running, find its PID:

```bash
ps aux | grep your_application_name
```

The second column is your PID (e.g., `10054`).

### Step 2: Set Up Profiling

1. Open the Edge AI Sizing Tool dashboard
2. Click **"Add Workload"** or the **+** icon
3. Select **Task**: `Custom Application Monitoring`
4. Choose **Process Selection**:
   - **PID** (recommended): Enter your process ID (e.g., `10054`)
   - **Application Path**: Enter application/process name
     - Python application: `python3 /path/to/your_script.py`
     - Node.js application: `node /path/to/your_script.js`
     - Custom binary: `/path/to/your_program`
5. Set **Duration**: 30-300 seconds (60 seconds recommended)
6. Click **"Add Workload"**

**Using Custom Python Environments:**

If your application requires a specific Python environment (virtual environment, conda, or specific Python version), specify the full path to the Python executable:

- Virtual environment: `/home/user/myproject/venv/bin/python /home/user/myproject/app.py`
- Conda environment: `/home/user/miniconda3/envs/myenv/bin/python /path/to/script.py`
- Specific Python version: `/usr/bin/python3.11 /path/to/your_script.py`
- With arguments: `/path/to/venv/bin/python script.py --config prod.json`

### Step 3: Wait for Results

The profiling takes your specified duration plus 15-20 seconds for processing. You'll see a progress bar with countdown.

**Don't close your browser during profiling.**

## Understanding Results

The dashboard shows comprehensive performance metrics:

### Performance Status

Shows overall health of your application with severity level (HEALTHY, WARNING, or CRITICAL) and identifies the primary bottleneck resource if any issues are detected.

### Key Metrics

**Baseline**: Shows system resource usage before your app started (should be < 20%)

**CPU Usage** (0-100% per core)
- < 30%: Light usage
- 30-70%: Moderate usage
- 70-90%: High usage
- \> 90%: Bottleneck

**GPU Usage** (0-100%)
- Shows how much of GPU capacity is being used
- High usage (>80%) may indicate GPU bottleneck

**NPU Usage** (Intel® Core™ Ultra processors only)
- Neural Processing Unit utilization
- Only used by AI models targeting NPU

**Memory**
- Shows RAM and GPU memory consumption
- Peak values show maximum usage

**Disk I/O**
- Read/Write throughput in MB/s
- High values indicate data-intensive operations

---

## Troubleshooting

### "Please provide a valid PID"
- Enter a numeric PID (e.g., `10054`)
- Verify process is running: `ps -p 10054`

### "Process not found"
- Check if process is still running: `ps -p <PID>`
- Ensure you have permission to monitor it
- For short-lived processes, profile the parent process

### High baseline warning
- Close unnecessary applications
- Wait for system to stabilize
- Background usage affects measurement accuracy

### All metrics show 0%
- Verify PID is correct: `ps -p <PID>`
- Check if you have permission to monitor the process
- Ensure application is active during profiling

### GPU shows 0% despite using GPU
- Verify GPU drivers: `xpumcli discovery`
- Check if application actually uses GPU
- See main README for driver installation

---

## Tips

**Best Duration Settings:**
- Quick check: 30 seconds
- Standard profiling: 60 seconds
- Comprehensive: 120-300 seconds
- Long service: 300-600 seconds

**For Accurate Results:**
- Close background applications before profiling
- Use consistent baseline (< 20% CPU/memory)
- Profile long enough to capture typical behavior
- Run multiple times and compare results

**Optimization Workflow:**
1. Profile to identify bottleneck
2. Apply recommended optimizations
3. Re-profile to measure improvement
4. Repeat for next bottleneck

---

## CLI Alternative

For automation or advanced usage:

```bash
cd workers/custom-application-profiling

# Check platform status
python3 main.py status

# Profile by PID
python3 main.py profile --pid 10054 --name "my_app" --duration 60

# Save results to JSON
python3 main.py profile --pid 10054 --name "my_app" --duration 60 --output results.json
```

### Using Custom Python Environments (CLI)

When using the CLI, run `main.py` with the profiler's Python environment (which has dependencies installed), while your application can use a different Python environment:

```bash
cd workers/custom-application-profiling

# Use profiler's venv - application uses same venv
venv/bin/python main.py profile --app "venv/bin/python your_app.py" --duration 30

# Profile app in conda environment
venv/bin/python main.py profile \
    --app "/home/user/miniconda3/envs/myenv/bin/python app.py" \
    --name "my_app" \
    --duration 60 \
    --output results.json
```

**Note:** If you see `ERROR: psutil module not found`, use the profiler's venv: `venv/bin/python main.py` instead of `python3 main.py`

---

## More Information

- **Intel® VTune™ Profiler**: [software.intel.com/vtune](https://software.intel.com/vtune)
- **Intel® OpenVINO™**: [docs.openvino.ai](https://docs.openvino.ai)
- **Main README**: [README.md](../README.md)

---

## License

Copyright (C) 2025 Intel Corporation
SPDX-License-Identifier: Apache-2.0


List worker directories


automatic-speech-recognition
custom-application-profiling
dlstreamer
instance-segmentation
text-generation
text-to-image
text-to-speech


List custom profiling worker


bottleneck_analyzer.py
main.py
requirements.txt