28.07.2013 Views

Download PDF - AMD Developer Central

Download PDF - AMD Developer Central

Download PDF - AMD Developer Central

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ADVANCED OPENCL TM AND<br />

OPENGL® DEBUGGING AND<br />

PROFILING<br />

Yaki Tebeka<br />

<strong>AMD</strong><br />

Fellow, <strong>Developer</strong> Tools


OPENCL TM<br />

OpenCL<br />

– A framework for writing parallel computing applications that execute<br />

across heterogeneous platforms consisting of APUs, CPUs, GPUs<br />

and other processors<br />

– Enables both task-based and data-based parallelism<br />

– An open, royalty-free, cross-platform standard, managed by<br />

the Khronos Group<br />

– Implementations are available from:<br />

<strong>AMD</strong>, Intel, NVIDIA, Apple, IBM, ARM, …<br />

3 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


OPENGL®<br />

OpenGL<br />

– A software interface for 2D and 3D graphics hardware<br />

– An open, royalty-free, cross-platform standard managed by the Khronos Group<br />

– Widely used on Windows, Linux, Mac, Solaris, …<br />

– OpenGL|ES is the de-facto standard for 3D graphics on embedded systems<br />

4 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


PARALLEL COMPUTING OVER APUS AND GPUS<br />

APUs and GPUs are massively multithreaded<br />

– Hundreds of cores<br />

– Thousands of concurrent threads<br />

Ideal for parallel computing tasks<br />

– A lot of horse power, optimized for parallel computing<br />

– Significantly faster than multi-core CPUs<br />

– Order of magnitude performance improvement<br />

5 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


DEBUGGING AND PROFILING MODEL<br />

Debugging and Profiling GPU based applications is hard<br />

On-time delivery of robust (bug-free) 3D graphics and<br />

parallel computing applications is challenging<br />

It is virtually impossible to optimize an application to<br />

fully utilize the available parallel computing system resources<br />

6 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


DEBUGGING AND PROFILING MODEL<br />

OpenCL is a “Black Box”<br />

The application enqueues OpenCL commands<br />

The OpenCL runtime executes the commands<br />

The developer cannot<br />

– Debug the OpenCL kernels<br />

– See the execution details<br />

– View runtime loads<br />

7 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011<br />

Application


gDEBUGGER TM<br />

gDEBugger for<br />

Microsoft Visual Studio®<br />

An OpenCL and OpenGL<br />

Debugger<br />

– API Level<br />

– OpenCL Kernel<br />

Source Code<br />

Integrated into Microsoft<br />

Visual Studio<br />

Provides the information a<br />

developer needs to find bugs<br />

and optimize an applications<br />

memory consumption<br />

8 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


DEMO<br />

Smoke Simulation Sample<br />

A sample application provided with gDEBugger<br />

Simulates smoke on 3D grids (density, velocity, temperature)<br />

OpenCL kernels solve Navier-Stokes equations<br />

A 3D texture is shared between OpenCL and OpenGL<br />

A density field grid is copied into 3D texture<br />

OpenGL renders the 3D density texture<br />

9 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


GDEBUGGER<br />

API Calls History View<br />

Displays a log of OpenCL and OpenGL API calls<br />

Call details are displayed in the Properties view<br />

10 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

gDEBugger Explorer<br />

Displays OpenCL and OpenGL allocated objects<br />

Marks OpenGL-OpenCL shared contexts<br />

Focuses the GUI views on objects<br />

Double-click displays each object in the<br />

appropriate view<br />

11 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Source Code and Call Stack<br />

Displays C, C++ and<br />

OpenCL C source code<br />

Enables setting source<br />

code breakpoints<br />

Displays a combined C, C++<br />

and OpenCL C call stack<br />

12 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Watch Views<br />

Displays OpenCL kernel’s variable values and types<br />

13 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Multi Watch View<br />

Displays the values of an<br />

OpenCL kernel variable across<br />

all work items and work groups<br />

The image view provides a<br />

graphics representation of the<br />

data (each pixel represents a<br />

single work item)<br />

14 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Current Work Item Toolbar<br />

Enables the selection of the focused work item<br />

The watch views will display the focused work item’s variables values<br />

When stepping through code, code locations where the focused work item is not valid will be skipped<br />

15 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Memory View<br />

Displays information about the application’s compute and graphic memory consumption<br />

Displays the call stack that existed at object creation<br />

Detects memory leaks<br />

16 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER<br />

Statistics View<br />

Displays statistical information about the application’s<br />

OpenCL and OpenGL APIs usage<br />

– A breakdown of the types of API functions used<br />

– Warnings about unrecommended and deprecated API usage<br />

– OpenGL vertex batches information<br />

17 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


PROFILING WITH <strong>AMD</strong> APP PROFILER<br />

<strong>AMD</strong> APP Profiler<br />

A performance analysis tool that gathers data from the OpenCL run-time and<br />

<strong>AMD</strong> Radeon TM GPUs during the execution of an OpenCL application<br />

Integrated into Microsoft Visual Studio® 2008 and 2010<br />

Command line utility program for Windows and Linux® platforms<br />

Support OpenCL and DirectCompute<br />

No custom driver requirements<br />

No code or project modifications to target application necessary<br />

http://developer.amd.com/gpu/<strong>AMD</strong>APPProfiler<br />

18 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


<strong>AMD</strong> APP PROFILER<br />

19 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


PROFILING USING <strong>AMD</strong> APP KERNELANALYZER AND GPU SHADERANALYZER<br />

<strong>AMD</strong> APP KernelAnalyzer and GPU Shader Analyzer<br />

Static analysis tools to compile, analyze and disassemble OpenCL C kernels, HLSL and GLSL shaders<br />

Compile and analyze for multiple Catalyst drivers and GPU device targets<br />

View compilation warning and error messages<br />

View <strong>AMD</strong> Intermediate Language (IL) and hardware disassembly (ISA) code<br />

View various statistics generated by analyzing the ISA code<br />

http://developer.amd.com/gpu/<strong>AMD</strong>APPKernelAnalyzer<br />

http://developer.amd.com/gpu/shader<br />

20 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


<strong>AMD</strong> APP KERNELANALYZER AND GPU SHADERANALYZER<br />

21 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


PROFILING USING <strong>AMD</strong> CODE ANALYST<br />

<strong>AMD</strong> CODE ANALYST<br />

Performance analysis tool for <strong>AMD</strong> CPUs<br />

Find CPU performance hotspots and issues<br />

Drill down to functions, source code and individual instructions<br />

Tune both managed and native code (Java, OpenCL, C, C++, Fortran)<br />

Analyze programs on multi-core and NUMA platforms<br />

Available as a standalone product and as a Visual Studio extension<br />

http://developer.amd.com/cpu/CodeAnalyst<br />

22 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


<strong>AMD</strong> CODE ANALYST<br />

23 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


DEBUGGING AND PROFILING USING GPU PERF STUDIO<br />

GPU PerfStudio<br />

Performance analysis tool for <strong>AMD</strong> GPUs and APUs<br />

Integrates four tools aimed for graphics developers<br />

– Frame Debugger<br />

– Frame Profiler<br />

– Shader Debugger<br />

– API Trace<br />

http://developer.amd.com/gpu/PerfStudio<br />

24 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


GPU PERF STUDIO<br />

25 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


DEBUGGING AND PROFILING USING GDEBUGGER STANDALONE<br />

gDEBugger Stand-alone<br />

An OpenGL and OpenCL debugger, profiler and memory analyzer<br />

Provides the information a developer needs to find bugs and optimize application performance<br />

Available for Windows, Mac and Linux<br />

http://www.gremedy.com/products.php<br />

26 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


gDEBUGGER STANDALONE<br />

27 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011


QUESTIONS


Disclaimer & Attribution<br />

The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions and<br />

typographical errors.<br />

The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product<br />

and roadmap changes, component and motherboard version changes, new model and/or product releases, product differences between<br />

differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. There is no obligation to update or otherwise correct or<br />

revise this information. However, we reserve the right to revise this information and to make changes from time to time to the content hereof<br />

without obligation to notify any person of such revisions or changes.<br />

NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE CONTENTS HEREOF AND NO RESPONSIBILITY IS<br />

ASSUMED FOR ANY INACCURACIES, ERRORS OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION.<br />

ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED.<br />

IN NO EVENT WILL ANY LIABILITY TO ANY PERSON BE INCURRED FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER<br />

CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF EXPRESSLY ADVISED<br />

OF THE POSSIBILITY OF SUCH DAMAGES.<br />

<strong>AMD</strong>, <strong>AMD</strong> Radeon, gDEBugger, the <strong>AMD</strong> arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. All other<br />

names used in this presentation are for informational purposes only and may be trademarks of their respective owners.<br />

OpenCL and OpenGL logo are trademarks of Apple Inc. used by permission by Khronos.<br />

Windows and Visual Studio are registered trademarks of Microsoft Corporation.<br />

Mac is a registered trademark of Apple Inc.<br />

Linux is a registered trademark of Linus Torvalds.<br />

© 2011 Advanced Micro Devices, Inc. All rights reserved.<br />

29 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!