<jupyter_start><jupyter_text>Intel® Advisor - Roofline Analysis This sections demonstrates how to collect and generate a roofline report using Intel Advisor.  Learning Objectives- Explain how Intel® Advisor performs GPU Roofline Analysis.- Run the GPU Roofline Analysis using command line syntax.- Use GPU Roofline Analysis to identify effective optimization strategies.  What is Roofline Model? A Roofline chart is a visual representation of application performance in relation to hardware limitations, including memory bandwidth and computational peaks.  Requirements Roofline Model on a GPU  * Application running partially on a GPU   * It must be integrated graphics (gen9 or gen11)   * Offload can be implemented with OpenMP, SYCL, DPC++, OpenCL  * A recent version of Intel® Advisor (Beta 4)  * Generating a Roofline Model on GPU generates a multi-level roofline   * A single loop generates several dots   * Each dot can be compared to its own memory (GTI/L3/DRAM/SLM)  Intel® Gen9 Memory Hierarchy![image](assets/gen9.png)  Advisor Command-Line for collecting and reporting "roofline"<jupyter_code>%%writefile advisor_roofline.sh
#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
export ADVIXE_EXPERIMENTAL=gpu-profiling
advixe-cl –collect=survey --enable-gpu-profiling --project-dir=./advisor_roofline --search-dir src:r=. -- ./rtm_stencil
advixe-cl –collect=tripcounts --stacks --flop --enable-gpu-profiling --project-dir=./advisor_roofline --search-dir src:r=. -- ./rtm_stencil
advixe-cl --report=roofline --gpu --project-dir=./advisor_roofline --report-output=./advisor_roofline/roofline.html<jupyter_output><empty_output><jupyter_text>Display Advisor "roofline" report  * GPU Roofline Performance Insights  * Highlights poor performing loops  * Shows performance ‘headroom’  for each loop    * Which can be improved    * Which are worth improving  * Shows likely causes of bottlenecks    * Memory bound vs. compute bound    * Suggests next optimization steps  Let's run a roofline report -- this is another live report that is interactive. [Intel Advisor Roofline report](assets/roofline.html)<jupyter_code>import os
os.system('/bin/echo $(whoami) is running DPCPP_Essentials Module5 -- Intel Advisor - 1 of 1 advisor_roofline.html')
from IPython.display import IFrame
IFrame(src='assets/roofline.html', width=1024, height=769)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0849727919631645, 'fraction_numerical': 0.00795311845960653, 'mean_word_length': 4.886699507389163, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '87504', 'license': 'MIT', 'n_tokens_mistral': 724, 'n_tokens_neox': 696, 'n_words': 250, 'path': 'Training/05_Intel_Advisor/roofline_analysis.ipynb', 'repo_name': 'jcarlosrm/BaseKit-code-samples', 'size': '2389'}