Skip to content

Commit 41a2c14

Browse files
authored
Added VTune on IDC setup (#2001)
1 parent 2cddadb commit 41a2c14

File tree

8 files changed

+229
-8
lines changed

8 files changed

+229
-8
lines changed

DirectProgramming/C++SYCL/Jupyter/oneapi-essentials-training/06_Intel_VTune_Profiler/Intel_VTune_Profiler.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# VTune™ Profiling on Intel® DevCloud"
7+
"# Intel VTune Profiler"
88
]
99
},
1010
{
@@ -28,7 +28,7 @@
2828
"cell_type": "markdown",
2929
"metadata": {},
3030
"source": [
31-
"- Profile a SYCL application using the VTune™ profiling tool on Intel® DevCloud\n",
31+
"- Profile a SYCL application using the VTune™ profiling tool on Intel® Developer Cloud\n",
3232
"- Understand the basics of VTune™ command line options for collecting data and generating reports"
3333
]
3434
},
@@ -45,7 +45,7 @@
4545
"source": [
4646
"VTune™ allows SYCL Profiling capabilities so you can tune for CPU, GPU, and FPGA.\n",
4747
"\n",
48-
"![VTune UI](vtuneui.png)\n",
48+
"![VTune UI](assets/vtuneui.png)\n",
4949
"\n",
5050
"__Analyze Data Parallell C++__ :\n",
5151
"See the lines of DPC++ that consume the most time\n",
@@ -104,11 +104,11 @@
104104
"cell_type": "markdown",
105105
"metadata": {},
106106
"source": [
107-
"VTune™ Command-line is useful when on __Intel® DevCloud__ or you only have __SSH__ access to development system.\n",
107+
"VTune™ Command-line is useful when on __Intel® Developer Cloud__ or you only have __SSH__ access to development system.\n",
108108
"\n",
109109
"However, it is recommended to install the __full VTune™ version__ on a local system and use the __UI rich experience__ of VTune Profiling Tool.\n",
110110
"\n",
111-
"![VTune UI](vtuneui.png)\n"
111+
"![VTune UI](assets/vtuneui.png)\n"
112112
]
113113
},
114114
{
@@ -323,9 +323,9 @@
323323
],
324324
"metadata": {
325325
"kernelspec": {
326-
"display_name": "Python 3.7 (Intel® oneAPI)",
326+
"display_name": "Python 3 (ipykernel)",
327327
"language": "python",
328-
"name": "c009-intel_distribution_of_python_3_oneapi-beta05-python"
328+
"name": "python3"
329329
},
330330
"language_info": {
331331
"codemirror_mode": {
@@ -337,7 +337,7 @@
337337
"name": "python",
338338
"nbconvert_exporter": "python",
339339
"pygments_lexer": "ipython3",
340-
"version": "3.9.7"
340+
"version": "3.11.5"
341341
},
342342
"toc": {
343343
"base_numbering": 1,
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "4534a157-d01f-4be2-9ee9-153509e8872b",
6+
"metadata": {},
7+
"source": [
8+
"# VTune Profiling on Intel Developer Cloud\n",
9+
"\n",
10+
"VTune Profiling can be accomplished on Intel Developer Cloud using one of two methods:\n",
11+
"\n",
12+
"1. [VTune Server Web UI for Collection and Analysis](#VTune-Server-Web-UI-for-Collection-and-Analysis)\n",
13+
"2. [VTune Command Line for Collection and VTune GUI for Analysis](#VTune-Command-Line-for-Collection-and-VTune-GUI-for-Analysis)\n",
14+
"\n",
15+
"__Option 1__ requires you to __start VTune server on Intel Developer Cloud__ and you can __access the VTune UI in web browser__, it also requires you to __setup ssh reverse proxy from local machine__, VTune Web UI may be slow to load data since it is fetched from cloud. It does not require any local installation, but does have extra step of setting up SSH keys for Intel Developer Cloud so that you can start a reverse proxy to access VTune web UI.\n",
16+
"\n",
17+
"__Option 2__ requires you to __install Intel VTune Profiler on your local machine__ for analysis. VTune collection is done using __cmd line on Intel Developer Cloud__ and the data is copied to local machine for analysis. This option is faster to do analysis since the data and VTune application is installed on local machine."
18+
]
19+
},
20+
{
21+
"cell_type": "markdown",
22+
"id": "5c84fa7c-d4ee-4c3c-a0e9-4343b1001b71",
23+
"metadata": {
24+
"jp-MarkdownHeadingCollapsed": true
25+
},
26+
"source": [
27+
"## VTune Server Web UI for Collection and Analysis\n",
28+
"\n",
29+
"For this setup, you have to __start VTune server on Intel Developer Cloud__, you will have to __setup ssh reverse proxy from local machine__ and you can __access the VTune UI in web browser__ as shown in the picture below.\n",
30+
"\n",
31+
"<img src=\"assets/vtune_server_block.png\" width=\"75%\">\n",
32+
"\n",
33+
"Quick setup instructions are for advanced users, refer to detailed setup instructions below for detailed step-by-step guide.\n",
34+
"\n",
35+
"### Quick Setup Instructions:\n",
36+
"\n",
37+
"1. Start VTune server on Intel Developer Cloud:\n",
38+
"\n",
39+
" `$vtune-backend --allow-remote-access --enable-server-profiling`\n",
40+
"\n",
41+
" Make a note of IP and PORT in the URL displayed\n",
42+
"\n",
43+
"2. In local machine terminal, create a reverse proxy:\n",
44+
"\n",
45+
" `ssh uXXXXXXXXXXXXXXX@idcbetabatch.eglb.intel.com -L PORT:IP:PORT`\n",
46+
"\n",
47+
"3. In local machine browser, copy the URL from step 1 and replace IP with `127.0.0.1`\n",
48+
"\n",
49+
" `https://127.0.0.1:PORT/?xxxx`\n",
50+
"\n",
51+
" This will launch VTune Web UI\n",
52+
"\n",
53+
"4. Select \"Analysis Configuration\" in VTune Web UI, enter the \"Application\" full path of binary on Intel Developer Cloud (pwd), Select \"Performance Snapsot\" to \"GPU Hotspot\" and Run\n",
54+
"\n",
55+
"\n",
56+
"### Detailed Setup Instructions:\n",
57+
"Below are the steps to setup VTune server and VTune Web UI:\n",
58+
"1. Start VTune server on Intel Developer Cloud\n",
59+
"2. Create a reverse proxy from local machine\n",
60+
"3. Launch VTune Web UI\n",
61+
"4. Start VTune Analysis\n",
62+
"\n",
63+
"#### Start VTune server on Intel Developer Cloud\n",
64+
"In Jupyter terminal (or SSH terminal), start vtune server:\n",
65+
"```\n",
66+
"$vtune-backend --allow-remote-access --enable-server-profiling\n",
67+
"```\n",
68+
"\n",
69+
"The above command will display a URL to open in browser which will look like shown below, make note of IP_ADDRESS and PORT in the URL\n",
70+
"<img src=\"assets/vtune_server.png\">\n",
71+
"\n",
72+
"\n",
73+
"#### Create a reverse proxy from localhost\n",
74+
"\n",
75+
"In Intel Developer Cloud Console:\n",
76+
"- select \"Training and Workshops\"\n",
77+
"- click on title of any training, and select \"Options\" dropdown\n",
78+
"- select \"Upload Key\" and add ssh key, if u have not added one before\n",
79+
"- click \"Launch Using SSH\"\n",
80+
"- Copy the ssh command\n",
81+
"\n",
82+
"In local machine terminal, setup reverse proxy:\n",
83+
"\n",
84+
"(ssh command copied above) + `-L PORT:IP_ADDRESS:PORT`\n",
85+
"```\n",
86+
"ssh xxxx@xxxx.com -L PORT:IP_ADDRESS:PORT\n",
87+
"```\n",
88+
"Command should look like below:\n",
89+
"```\n",
90+
"ssh uXXXXXXXXXXXXXXX@idcbetabatch.eglb.intel.com -L 39317:10.10.10.32:45571\n",
91+
"```\n",
92+
"\n",
93+
"#### Launch VTune Web UI\n",
94+
"\n",
95+
"Copy URL displayed in the Jupyter Terminal from earlier step.\n",
96+
"\n",
97+
"Open Browser on local machine and open the URL with IP_ADDRESS replaced with `127.0.0.1`, it should look similar to the one below:\n",
98+
"```\n",
99+
"https://127.0.0.1:45571/?xxxx\n",
100+
"```\n",
101+
"This should launch VTune Web UI\n",
102+
"\n",
103+
"#### Start VTune Analysis from Web UI\n",
104+
"\n",
105+
"- Click \"Configure Analysis\"\n",
106+
"- In the \"Application\" field enter the full path to the binary you want to profile:\n",
107+
" - Compile any SYCL code to get binary like `a.out`\n",
108+
" - To get full path, `cd` to the location of binary in Jupyter terminal and enter `pwd`, copy the full path\n",
109+
" - example: `/home/uXXXXX/test/a.out`\n",
110+
"- For \"Performance Snapshot\" select \"GPU Hotspots\"\n",
111+
"- Click the Run button\n",
112+
"<img src=\"assets/vtune_web_configure.png\">\n",
113+
"- Wait for collection to complete and then UI will load for analysis\n",
114+
"- Navigate to the \"Graphics\" tab and then \"Platform\" tab to analyze performance timeline and compute stats\n",
115+
"- Refer to VTune Profiler documentation for more information\n",
116+
"\n",
117+
"\n",
118+
"Instead of doing \"Configure Analysis\" from the VTune Web UI, you can also collect data using the vtune command line and then open the analysis on VTune Web UI:\n",
119+
"- In a Jupyter terminal, run VTune command line to collect data:\n",
120+
"```\n",
121+
"vtune -collect gpu-hotspots -result-dir ~/intel/vtune/projects/vtune_data $(pwd)/a.out\n",
122+
"```\n",
123+
"Make sure to set the `-result-dir` value to ` ~/intel/vtune/projects/<name-for-project>`\n",
124+
"\n",
125+
"- The `vtune_data` will appear in \"Project Navigator\" panel in the left side of Web UI, click on it to open analysis"
126+
]
127+
},
128+
{
129+
"cell_type": "markdown",
130+
"id": "101605b5-172f-43be-ae03-4157dedc2d4f",
131+
"metadata": {},
132+
"source": [
133+
"## VTune Command Line for Collection and VTune GUI for Analysis\n",
134+
"\n",
135+
"For this setup, you have start VTune collection using __vtune cmd line on Intel Developer Cloud__, the data has to be copied to local machine and you have to __install Intel VTune Profiler on your local machine__ for analysis of data as shown in picture below:\n",
136+
"\n",
137+
"<img src=\"assets/vtune_gui_block.png\" width=\"75%\">\n",
138+
"\n",
139+
"Quick setup instructions are for advanced users, refer to detailed setup instructions below for detailed step-by-step guide.\n",
140+
"\n",
141+
"### Quick Setup Instructions:\n",
142+
"\n",
143+
"1. Collect VTune data on Intel Developer Cloud:\n",
144+
"\n",
145+
" `vtune -collect gpu-hotspots -result-dir vtune_data $(pwd)/a.out`\n",
146+
"\n",
147+
"2. Compress the `vtune_data` folder\n",
148+
"\n",
149+
" `tar -cvf vtune_data.tgz vtune_data`\n",
150+
"\n",
151+
"3. Download `vtune_data.tgz` to local computer and uncompress\n",
152+
"\n",
153+
" `tar -xvf vtune_data.tgz`\n",
154+
"\n",
155+
"4. Open results in local installation of VTune\n",
156+
"\n",
157+
" Install VTune on oneAPI Base Toolkit on local machine and launch VTune\n",
158+
"\n",
159+
" Select \"Open Results\" and point to the `*.vtune` file in `vtune_data` folder\n",
160+
"\n",
161+
"\n",
162+
"### Detailed Setup Instructions:\n",
163+
"Below are steps to run vtune cmd line and download data for analysis on local machine.\n",
164+
" 1. Use vtune command line to collect vtune profiling data\n",
165+
" 2. Compress vtune data\n",
166+
" 3. Download vtune data to local computer\n",
167+
" 4. Install VTune Profiler on local computer and open vtune data for analysis\n",
168+
"\n",
169+
"#### Collect VTune data using command line\n",
170+
"- Modify the module's example code and then \"Build and Run\", this will generate the binary `a.out`\n",
171+
"- Then in \"Terminal\", go to the current module directory and run the following vtune command (change the `-result-dir` value from `vtune_data` to something that identifies your code) \n",
172+
"```\n",
173+
"vtune -collect gpu-hotspots -result-dir vtune_data $(pwd)/a.out\n",
174+
"```\n",
175+
"\n",
176+
"#### Compress vtune data\n",
177+
"- Compress the vtune results directory to copy to your location computer (GUI)\n",
178+
"```\n",
179+
"tar -cvf vtune_data.tgz vtune_data\n",
180+
"```\n",
181+
"#### Download and Uncompress vtune data\n",
182+
"- Download the compressed vtune results:\n",
183+
" - If using Jupyter, right click on the `*.tgz` file and select \"Download\"\n",
184+
" - If using `ssh`, use `scp` to copy the `*.tgz` to your GUI computer\n",
185+
"- Uncompress the vtune results files:\n",
186+
"```\n",
187+
"tar -xvf vtune_data.tgz\n",
188+
"```\n",
189+
"\n",
190+
"#### VTune Analysis on local machine\n",
191+
"- On your computer, install \"Intel VTune Profiler\" from [__Intel oneAPI Base Toolkit__](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html)\n",
192+
"- Open __Intel VTune Profiler__ and select the option to \"Open Results\" in the \"Welcome\" tab and select the vtune results directory that was downloaded, select the *.vtune file.\n",
193+
"- Navigate to the \"Graphics\" tab and then \"Platform\" tab to analyze performance timeline and compute stats\n",
194+
"- Refer to VTune Profiler documentation for more information\n",
195+
"\n",
196+
"<img src=\"assets/vtune_profiler.png\">"
197+
]
198+
}
199+
],
200+
"metadata": {
201+
"kernelspec": {
202+
"display_name": "Python 3 (ipykernel)",
203+
"language": "python",
204+
"name": "python3"
205+
},
206+
"language_info": {
207+
"codemirror_mode": {
208+
"name": "ipython",
209+
"version": 3
210+
},
211+
"file_extension": ".py",
212+
"mimetype": "text/x-python",
213+
"name": "python",
214+
"nbconvert_exporter": "python",
215+
"pygments_lexer": "ipython3",
216+
"version": "3.11.5"
217+
}
218+
},
219+
"nbformat": 4,
220+
"nbformat_minor": 5
221+
}
35 KB
Loading
225 KB
Loading
51.5 KB
Loading
34 KB
Loading
269 KB
Loading

0 commit comments

Comments
 (0)