ADVANCED OPENCLTM AND OPENGL® DEBUGGING AND PROFILING
Yaki TebekaAMDFellow, Developer Tools
3 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
OPENCL TM
OpenCL– A framework for writing parallel computing applications that execute
across heterogeneous platforms consisting of APUs, CPUs, GPUs and other processors
– Enables both task-based and data-based parallelism– An open, royalty-free, cross-platform standard, managed by
the Khronos Group– Implementations are available from:
AMD, Intel, NVIDIA, Apple, IBM, ARM, …
4 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
OPENGL®
OpenGL– A software interface for 2D and 3D graphics hardware– An open, royalty-free, cross-platform standard managed by the Khronos Group– Widely used on Windows, Linux, Mac, Solaris, …– OpenGL|ES is the de-facto standard for 3D graphics on embedded systems
5 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
PARALLEL COMPUTING OVER APUS AND GPUS
APUs and GPUs are massively multithreaded– Hundreds of cores– Thousands of concurrent threads
Ideal for parallel computing tasks– A lot of horse power, optimized for parallel computing– Significantly faster than multi-core CPUs– Order of magnitude performance improvement
6 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
DEBUGGING AND PROFILING MODEL
Debugging and Profiling GPU based applications is hard
On-time delivery of robust (bug-free) 3D graphics and parallel computing applications is challenging
It is virtually impossible to optimize an application to fully utilize the available parallel computing system resources
7 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
DEBUGGING AND PROFILING MODEL
OpenCL is a “Black Box”
The application enqueues OpenCL commands
The OpenCL runtime executes the commands
The developer cannot– Debug the OpenCL kernels – See the execution details– View runtime loads
Application
8 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGERTM
gDEBugger for Microsoft Visual Studio®
An OpenCL and OpenGL Debugger
– API Level– OpenCL Kernel
Source Code
Integrated into Microsoft Visual Studio
Provides the information a developer needs to find bugs and optimize an applications memory consumption
9 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
DEMO
Smoke Simulation Sample
A sample application provided with gDEBugger
Simulates smoke on 3D grids (density, velocity, temperature)
OpenCL kernels solve Navier-Stokes equations
A 3D texture is shared between OpenCL and OpenGL
A density field grid is copied into 3D texture
OpenGL renders the 3D density texture
10 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
GDEBUGGER
API Calls History View
Displays a log of OpenCL and OpenGL API calls
Call details are displayed in the Properties view
11 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
gDEBugger Explorer
Displays OpenCL and OpenGL allocated objects
Marks OpenGL-OpenCL shared contexts
Focuses the GUI views on objects
Double-click displays each object in the appropriate view
12 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Source Code and Call Stack
Displays C, C++ and OpenCL C source code
Enables setting sourcecode breakpoints
Displays a combined C, C++and OpenCL C call stack
13 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Watch Views
Displays OpenCL kernel’s variable values and types
14 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Multi Watch View
Displays the values of an OpenCL kernel variable across all work items and work groups
The image view provides a graphics representation of the data (each pixel represents a single work item)
15 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Current Work Item Toolbar
Enables the selection of the focused work item
The watch views will display the focused work item’s variables values
When stepping through code, code locations where the focused work item is not valid will be skipped
16 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Memory View
Displays information about the application’s compute and graphic memory consumption
Displays the call stack that existed at object creation
Detects memory leaks
17 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER
Statistics ViewDisplays statistical information about the application’s OpenCL and OpenGL APIs usage
– A breakdown of the types of API functions used– Warnings about unrecommended and deprecated API usage– OpenGL vertex batches information
18 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
PROFILING WITH AMD APP PROFILER
AMD APP Profiler
A performance analysis tool that gathers data from the OpenCL run-time and AMD RadeonTM GPUs during the execution of an OpenCL application
Integrated into Microsoft Visual Studio® 2008 and 2010
Command line utility program for Windows and Linux® platforms
Support OpenCL and DirectCompute
No custom driver requirements
No code or project modifications to target application necessary
http://developer.amd.com/gpu/AMDAPPProfiler
19 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
AMD APP PROFILER
20 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
PROFILING USING AMD APP KERNELANALYZER AND GPU SHADERANALYZER
AMD APP KernelAnalyzer and GPU Shader Analyzer
Static analysis tools to compile, analyze and disassemble OpenCL C kernels, HLSL and GLSL shaders
Compile and analyze for multiple Catalyst drivers and GPU device targets
View compilation warning and error messages
View AMD Intermediate Language (IL) and hardware disassembly (ISA) code
View various statistics generated by analyzing the ISA code
http://developer.amd.com/gpu/AMDAPPKernelAnalyzerhttp://developer.amd.com/gpu/shader
21 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
AMD APP KERNELANALYZER AND GPU SHADERANALYZER
22 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
PROFILING USING AMD CODE ANALYST
AMD CODE ANALYST
Performance analysis tool for AMD CPUs
Find CPU performance hotspots and issues
Drill down to functions, source code and individual instructions
Tune both managed and native code (Java™, OpenCL, C, C++, Fortran)
Analyze programs on multi-core and NUMA platforms
Available as a standalone product and as a Visual Studio extension
http://developer.amd.com/cpu/CodeAnalyst
23 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
AMD CODE ANALYST
24 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
DEBUGGING AND PROFILING USING GPU PERF STUDIO
GPU PerfStudio
Performance analysis tool for AMD GPUs and APUs
Integrates four tools aimed for graphics developers– Frame Debugger– Frame Profiler– Shader Debugger– API Trace
http://developer.amd.com/gpu/PerfStudio
25 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
GPU PERF STUDIO
26 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
DEBUGGING AND PROFILING USING GDEBUGGER STANDALONE
gDEBugger Stand-alone
An OpenGL and OpenCL debugger, profiler and memory analyzer
Provides the information a developer needs to find bugs and optimize application performance
Available for Windows, Mac and Linux
http://www.gremedy.com/products.php
27 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
gDEBUGGER STANDALONE
QUESTIONS
29 | Advanced OpenCL and OpenGL Debugging and Profiling | June 2011
Disclaimer & AttributionThe information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions and typographical errors.
The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product and roadmap changes, component and motherboard version changes, new model and/or product releases, product differences between differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. There is no obligation to update or otherwise correct or revise this information. However, we reserve the right to revise this information and to make changes from time to time to the content hereof without obligation to notify any person of such revisions or changes.
NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE CONTENTS HEREOF AND NO RESPONSIBILITY IS ASSUMED FOR ANY INACCURACIES, ERRORS OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION.
ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. IN NO EVENT WILL ANY LIABILITY TO ANY PERSON BE INCURRED FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
AMD, AMD Radeon, gDEBugger, the AMD arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. All other names used in this presentation are for informational purposes only and may be trademarks of their respective owners.
OpenCL and OpenGL logo are trademarks of Apple Inc. used by permission by Khronos.
Windows and Visual Studio are registered trademarks of Microsoft Corporation.
Mac is a registered trademark of Apple Inc.
Linux is a registered trademark of Linus Torvalds.
© 2011 Advanced Micro Devices, Inc. All rights reserved.