16
Slide 1 of 16 Code Optimization and Performance Tuning Using Intel VTune In this session, you will learn to: Use the Tuning Assistant Objectives

07 intel v_tune_session_10

Embed Size (px)

Citation preview

Page 1: 07 intel v_tune_session_10

Slide 1 of 16

Code Optimization and Performance Tuning Using Intel VTune

In this session, you will learn to:

Use the Tuning Assistant

Objectives

Page 2: 07 intel v_tune_session_10

Slide 2 of 16

Code Optimization and Performance Tuning Using Intel VTune

Tuning assistant is a tool that provides with information that enables you to tune the performance of your application and the way it uses system resources.

Using Tuning Assistant

Page 3: 07 intel v_tune_session_10

Slide 3 of 16

Code Optimization and Performance Tuning Using Intel VTune

Once the optimization goals are clear, you can tune your application at the following three levels:

System-level tuning

Application-level tuning

Microarchitecture-level tuning

Understanding the Tuning Methodology

Page 4: 07 intel v_tune_session_10

Slide 4 of 16

Code Optimization and Performance Tuning Using Intel VTune

System-level tuning:

Helps in optimizing the utilization of system resources.

Speeds up the performance of the application by improving the way application interacts with the system.

Is significant for input/output (I/O) intensive applications. The performance of these applications depends on the performance of the I/O system that provides the I/O service.

Can be achieved by using the counter monitor feature of VTune Performance Analyzer.

Understanding the Tuning Methodology (Contd.)

Page 5: 07 intel v_tune_session_10

Slide 5 of 16

Code Optimization and Performance Tuning Using Intel VTune

Application-level tuning:

Helps in reducing the execution time of an application.

Can be performed by improving the algorithms of the application, implementing threads, and by using Application Programming Interfaces (APIs) and primitives.

Can be achieved by identifying the code snippets that have a high impact on the performance of the application.

Helps in identifying the code snippets by using the sampling or call graph feature of the VTune Performance Analyzer.

Understanding the Tuning Methodology (Contd.)

Page 6: 07 intel v_tune_session_10

Slide 6 of 16

Code Optimization and Performance Tuning Using Intel VTune

Microarchitecture-level tuning:

Increases the performance of an application by improving the way an application runs on the processor.

Can be used with processor-intensive applications

If an application is not processor-intensive, then you should first improve processor utilization by using system-level and application-level tuning.

Can be achieved by using the sampling feature of VTune Performance Analyzer.

Understanding the Tuning Methodology (Contd.)

Page 7: 07 intel v_tune_session_10

Slide 7 of 16

Code Optimization and Performance Tuning Using Intel VTune

Just a minute

Which level of tuning methodology will you use for

I/O-intensive application?

Which level of tuning methodology will you use for a

process-intensive application?

Which level of tuning methodology will you use to reduce

the execution time of an application?

Answer:

System-level tuning

Microarchitecture-level tuning

Application-level tuning

Page 8: 07 intel v_tune_session_10

Slide 8 of 16

Code Optimization and Performance Tuning Using Intel VTune

It is a good practice to start tuning an application at the system-level to avoid any system-level bottlenecks.

Once you ensure that the processor utilization is high, then you can focus on removing the application-level bottlenecks followed by microarchitecture-level bottlenecks.

If you are not sure about the specific goals, then you should follow the following sequence in order to achieve the best performance of an application in the shortest possible time:

System-level

Application-level

Microarchitecture-level

Tuning Methodology for Specific Goals

Page 9: 07 intel v_tune_session_10

Slide 9 of 16

Code Optimization and Performance Tuning Using Intel VTune

There are three main strategies to improve the performance of an application.

Each strategy affects processor utilization in a different way:

Balancing I/O and computation

Improving the threading model

Improving the efficiency of computation

Tuning Methodology for Specific Goals (Contd.)

This strategy enables you to speed up the

application when the processor utilization is

low.

In this case, you need to make changes at

the system-level and the application-level.

This strategy enables you to:

Add multithreading to a single threaded

application

Improve the threading model of a

multithreaded application

It enables you to make effective use of

system resources.

In this case, you need to make changes at

the application-level.

This strategy enables you to speed up the

application by accomplishing the same amount of

work using less computations.

In this case, you need to make changes at the

application-level and microarchitecture-level

Page 10: 07 intel v_tune_session_10

Slide 10 of 16

Code Optimization and Performance Tuning Using Intel VTune

Tuning assistant:

Helps you to get more insight into the performance issues in an application and identify the hotspots where performance can be improved.

Provides you with the possible solutions to remove or avoid a performance issue.

Provides tuning advice for codes, processes, or time ranges that you select in the source, sampling, or counter monitor views.

Launching Tuning Assistant

Page 11: 07 intel v_tune_session_10

Slide 11 of 16

Code Optimization and Performance Tuning Using Intel VTune

The different types of advice that tuning assistant can

provide are:

Sampling-based advice

Counter monitor-based advice

Source-based tuning advice

Static assembly penalties

Launching Tuning Assistant (Contd.)

Page 12: 07 intel v_tune_session_10

Slide 12 of 16

Code Optimization and Performance Tuning Using Intel VTune

Activity: Launching the Tuning Assistant

Problem Statement:

Chris has developed an application in C# that creates a list of

natural numbers and displays their sum. However, on

execution, the application runs very slowly. To analyze

performance of his application, Chris decides to analyze his

application using the counter monitor feature of Intel VTune

Performance Analyzer and use Tuning Assistant to identify the

performance issues and propose possible solutions for the

issues. Help Chris perform the required task.

Page 13: 07 intel v_tune_session_10

Slide 13 of 16

Code Optimization and Performance Tuning Using Intel VTune

Activity: Launching the Tuning Assistant (Contd.)

Solution

To analyze counter data and use Tuning Assistant to identify

system-related performance issues and propose possible

solutions for the issues, you need to perform the following

tasks:

1. Collect counter monitor data.

2. Launch Tuning Assistant.

Page 14: 07 intel v_tune_session_10

Slide 14 of 16

Code Optimization and Performance Tuning Using Intel VTune

Activity: Launching the Tuning Assistant (Contd.)

Solution

The information that tuning assistant provides are as follows:

Insight

Relevance scale

Tuning assistant advice

Workload

Page 15: 07 intel v_tune_session_10

Slide 15 of 16

Code Optimization and Performance Tuning Using Intel VTune

In this session, you learned that:

The Tuning Assistant tool of VTune Performance Analyzer

tunes the performance of applications.

You can tune the application at the following three levels:

System-Level tuning

Application-Level tuning

Microarchitecture-Level tuning

It is a good practice to start tuning an application at the system

level instead of microarchitecture level.

Three main strategies to improve the performance of an

application are:

Balancing I/O and computation

Improving the threading model

Improving the efficiency of computation

Summary

Page 16: 07 intel v_tune_session_10

Slide 16 of 16

Code Optimization and Performance Tuning Using Intel VTune

The tuning assistant helps you to get more insight into the

performance issues in an application and identify the hotspots

where performance can be improved.

The different types of advice that Tuning Assistant can

generate are:

Sampling-based advice

Counter monitor-based advice

Source-based tuning advice

Static assembly penalties

Summary