Introduction to Opencl™ Programming

Total Page:16

File Type:pdf, Size:1020Kb

Introduction to Opencl™ Programming Introduction to OpenCL™ Programming Training Guide Publication #: 137-41768-10 ∙ Rev: A ∙ Issue Date: May, 2010 Introduction to OpenCL™ Programming PID: 137-41768-10 ∙ Rev: A ∙ May, 2010 © 2010 Advanced Micro Devices Inc. All rights reserved. The contents of this document are provided in connection with Advanced Micro Devices, Inc. ("AMD") products. AMD makes no representations or warranties with respect to the accuracy or completeness of the contents of this publication and reserves the right to make changes to specifications and product descriptions at any time without notice. The information contained herein may be of a preliminary or advance nature and is subject to change without notice. No license, whether express, implied, arising by estoppel or otherwise, to any intellectual property rights is granted by this publication. Except as set forth in AMD's Standard Terms and Conditions of Sale, AMD assumes no liability whatsoever, and disclaims any express or implied warranty, relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particular purpose, or infringement of any intellectual property right. AMD's products are not designed, intended, authorized or warranted for use as components in systems intended for surgical implant into the body, or in other applications intended to support or sustain life, or in any other application in which the failure of AMD's product could create a situation where personal injury, death, or severe property or environmental damage may occur. AMD reserves the right to discontinue or make changes to its products at any time without notice. Trademarks AMD, the AMD Arrow logo, AMD Athlon, AMD Opteron, AMD Phenom, AMD Sempron, AMD Turion, and combinations thereof, are trademarks of Advanced Micro Devices, Inc. HyperTransport is a licensed trademark of the HyperTransport Technology Consortium. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. ii PID: 137-41768-10 ∙ Rev: A ∙ May, 2010 Introduction to OpenCL™ Programming Contents Chapter 1 Course Overview . 1 1.1 Objectives . 1 1.2 Audience . 1 1.3 References . 1 Chapter 2 Introduction . 3 2.1 What is GPU Compute? . 3 2.2 A Brief History of GPU Compute . 3 2.3 Heterogeneous Computing . 4 Chapter 3 Introduction to OpenCL . 7 3.1 What is OpenCL? . .7 3.1.1 Benefits of OpenCL . .7 3.2 Anatomy of OpenCL . 8 3.2.1 Language Specification . 8 3.2.2 Platform API . 8 3.2.3 Runtime API . 8 3.3 OpenCL Architecture . 8 3.3.1 The Platform Model . 9 3.3.2 The Execution Model . 11 3.3.3 The Memory Model . 14 Chapter 4 Getting Started with OpenCL . 17 4.1 The Software Development Environment and Tools . 17 4.1.1 Requirements . .17 4.1.2 Installing on Windows . 19 4.1.3 Installing on Linux . 21 4.2 "Hello World" in OpenCL . 22 4.3 Compiling OpenCL Source . 24 4.3.1 Compiling on Linux . 25 4.3.2 Compiling on Windows . 25 Chapter 5 OpenCL Programming in Detail . 29 iii Introduction to OpenCL™ Programming PID: 137-41768-10 ∙ Rev: A ∙ May, 2010 5.1 Executing an OpenCL Program . ..
Recommended publications
  • AMD Firestream™ 9350 GPU Compute Accelerator
    AMD FireStream™ 9350 GPU Compute Accelerator High Density Server GPU Acceleration The AMD FireStream™ 9350 GPU compute accelerator card offers industry- leading performance-per-watt in a highly dense, single-slot form factor. This AMD FireStream 9350 low-profile GPU card is designed for scalable high performance computing > Heterogeneous computing that (HPC) systems that require density and power efficiency. The AMD FireStream leverages AMD GPUs and x86 CPUs 9350 is ideal for a wide range of HPC applications across several industries > High performance per watt at 2.9 including Finance, Energy (Oil and Gas), Geosciences, Life Sciences, GFLOPS / Watt Manufacturing (CAE, CFD, etc.), Defense, and more. > Industry’s most dense server GPU card 1 Utilizing the multi-billion-transistor ASICs developed for AMD Radeon™ graphics > Low profile and passively cooled cards, AMD’s FireStream 9350 cards provide maximum performance-per-slot > Massively parallel, programmable GPU and are designed to meet demanding performance and reliability requirements architecture of HPC systems that can scale to thousands of nodes. AMD FireStream 9350 > Open standard OpenCL™ and cards include a single DisplayPort output. DirectCompute2 AMD FireStream 9350 cards can be used in scalable servers, blades, PCIe® > 2.0 TFLOPS, Single-Precision Peak chassis, and are available from many leading server OEMs and HPC solution > 400 GFLOPS, Double-Precision Peak providers. > 2GB GDDR5 memory Priced competitively, AMD FireStream GPUs offer unparalleled performance > Industry’s only Single-Slot PCIe® Accelerator and value for high performance computing. > PCI Express® 2.1 Compliant Note: For workstation and server > AMD Accelerated Parallel Processing installations that require active (APP) Technology SDK with OpenCL3 cooling, AMD FirePro™ Professional > 3-year planned availability; 3-year Graphics boards are software- limited warranty compatible and offer comparable features.
    [Show full text]
  • ATI Radeon™ HD 4870 Computation Highlights
    AMD Entering the Golden Age of Heterogeneous Computing Michael Mantor Senior GPU Compute Architect / Fellow AMD Graphics Product Group [email protected] 1 The 4 Pillars of massively parallel compute offload •Performance M’Moore’s Law Î 2x < 18 Month s Frequency\Power\Complexity Wall •Power Parallel Î Opportunity for growth •Price • Programming Models GPU is the first successful massively parallel COMMODITY architecture with a programming model that managgped to tame 1000’s of parallel threads in hardware to perform useful work efficiently 2 Quick recap of where we are – Perf, Power, Price ATI Radeon™ HD 4850 4x Performance/w and Performance/mm² in a year ATI Radeon™ X1800 XT ATI Radeon™ HD 3850 ATI Radeon™ HD 2900 XT ATI Radeon™ X1900 XTX ATI Radeon™ X1950 PRO 3 Source of GigaFLOPS per watt: maximum theoretical performance divided by maximum board power. Source of GigaFLOPS per $: maximum theoretical performance divided by price as reported on www.buy.com as of 9/24/08 ATI Radeon™HD 4850 Designed to Perform in Single Slot SP Compute Power 1.0 T-FLOPS DP Compute Power 200 G-FLOPS Core Clock Speed 625 Mhz Stream Processors 800 Memory Type GDDR3 Memory Capacity 512 MB Max Board Power 110W Memory Bandwidth 64 GB/Sec 4 ATI Radeon™HD 4870 First Graphics with GDDR5 SP Compute Power 1.2 T-FLOPS DP Compute Power 240 G-FLOPS Core Clock Speed 750 Mhz Stream Processors 800 Memory Type GDDR5 3.6Gbps Memory Capacity 512 MB Max Board Power 160 W Memory Bandwidth 115.2 GB/Sec 5 ATI Radeon™HD 4870 X2 Incredible Balance of Performance,,, Power, Price
    [Show full text]
  • AMD Accelerated Parallel Processing Opencl Programming Guide
    AMD Accelerated Parallel Processing OpenCL Programming Guide November 2013 rev2.7 © 2013 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo, AMD Accelerated Parallel Processing, the AMD Accelerated Parallel Processing logo, ATI, the ATI logo, Radeon, FireStream, FirePro, Catalyst, and combinations thereof are trade- marks of Advanced Micro Devices, Inc. Microsoft, Visual Studio, Windows, and Windows Vista are registered trademarks of Microsoft Corporation in the U.S. and/or other jurisdic- tions. Other names are for informational purposes only and may be trademarks of their respective owners. OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos. The contents of this document are provided in connection with Advanced Micro Devices, Inc. (“AMD”) products. AMD makes no representations or warranties with respect to the accuracy or completeness of the contents of this publication and reserves the right to make changes to specifications and product descriptions at any time without notice. The information contained herein may be of a preliminary or advance nature and is subject to change without notice. No license, whether express, implied, arising by estoppel or other- wise, to any intellectual property rights is granted by this publication. Except as set forth in AMD’s Standard Terms and Conditions of Sale, AMD assumes no liability whatsoever, and disclaims any express or implied warranty, relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particular purpose, or infringement of any intellectual property right. AMD’s products are not designed, intended, authorized or warranted for use as compo- nents in systems intended for surgical implant into the body, or in other applications intended to support or sustain life, or in any other application in which the failure of AMD’s product could create a situation where personal injury, death, or severe property or envi- ronmental damage may occur.
    [Show full text]
  • Download Radeon Grpadhics Catalylist and Driver AMD Catalyst Graphics Driver 13.4 X64
    download radeon grpadhics catalylist and driver AMD Catalyst Graphics Driver 13.4 x64. Fixes : - With the Radeon HD7790 graphics card, corruption may be seen in the game Tomb Raider with TressFX enabled - Texture flickering may be observed in DirectX 9.0c enabled applications - Corruption observed in Tomb Raider with TressFX enabled for AMD Crossfire and single GPU system configurations - Corruption observed on objects and textures in the game, Call of Duty – Black Ops 2 - Corruption observed in the game, Alan Wake (DirectX 9 Mode) when attempting to change in-game settings with Stereoscopic 3D using Tridef - Corruption observed on textures in the game, Battle Field: Bad Company 2 with forced anti-aliasing enabled - Adobe Photoshop CS6 experiences screen flicker under Windows 8 based system - Horizontal line corruption may be observed with forced anti-aliasing enabled in the game, Dishonored - System hang may occur when scrolling through the game selection menu in the game, DiRT 3 - F1 2012 may crash to desktop on systems supporting AMD PowerXpress (Enduro) Technology - Support added for AMD Radeon HD7790 and AMD Radeon HD 7990 - Catalyst Driver optimizations to improve performance in Far Cry 3, Crysis 3, and 3DMark - Significantly improves latency performance in Skyrim, Boderlands 2, Guild Wars 2, Tomb Raider and Hitman Absolution. Performance gains seen with the entire AMD Radeon HD 7000 Series for the following: - Batman Arkham City (1920x1200): Performance improvements up to 5% - Borderlands 2 (2560x1600): Performance improvements
    [Show full text]
  • AMD Codexl 1.7 GA Release Notes
    AMD CodeXL 1.7 GA Release Notes Thank you for using CodeXL. We appreciate any feedback you have! Please use the CodeXL Forum to provide your feedback. You can also check out the Getting Started guide on the CodeXL Web Page and the latest CodeXL blog at AMD Developer Central - Blogs This version contains: For 64-bit Windows platforms o CodeXL Standalone application o CodeXL Microsoft® Visual Studio® 2010 extension o CodeXL Microsoft® Visual Studio® 2012 extension o CodeXL Microsoft® Visual Studio® 2013 extension o CodeXL Remote Agent For 64-bit Linux platforms o CodeXL Standalone application o CodeXL Remote Agent Note about installing CodeAnalyst after installing CodeXL for Windows AMD CodeAnalyst has reached End-of-Life status and has been replaced by AMD CodeXL. CodeXL installer will refuse to install on a Windows station where AMD CodeAnalyst is already installed. Nevertheless, if you would like to install CodeAnalyst, do not install it on a Windows station already installed with CodeXL. Uninstall CodeXL first, and then install CodeAnalyst. System Requirements CodeXL contains a host of development features with varying system requirements: GPU Profiling and OpenCL Kernel Debugging o An AMD GPU (Radeon HD 5000 series or newer, desktop or mobile version) or APU is required. o The AMD Catalyst Driver must be installed, release 13.11 or later. Catalyst 14.12 (driver 14.501) is the recommended version. See "Getting the latest Catalyst release" section below. For GPU API-Level Debugging, a working OpenCL/OpenGL configuration is required (AMD or other). CPU Profiling o Time-Based Profiling can be performed on any x86 or AMD64 (x86-64) CPU/APU.
    [Show full text]
  • MSI Afterburner V4.6.4
    MSI Afterburner v4.6.4 MSI Afterburner is ultimate graphics card utility, co-developed by MSI and RivaTuner teams. Please visit https://msi.com/page/afterburner to get more information about the product and download new versions SYSTEM REQUIREMENTS: ...................................................................................................................................... 3 FEATURES: ............................................................................................................................................................. 3 KNOWN LIMITATIONS:........................................................................................................................................... 4 REVISION HISTORY: ................................................................................................................................................ 5 VERSION 4.6.4 .............................................................................................................................................................. 5 VERSION 4.6.3 (PUBLISHED ON 03.03.2021) .................................................................................................................... 5 VERSION 4.6.2 (PUBLISHED ON 29.10.2019) .................................................................................................................... 6 VERSION 4.6.1 (PUBLISHED ON 21.04.2019) .................................................................................................................... 7 VERSION 4.6.0 (PUBLISHED ON
    [Show full text]
  • AMD APP SDK Developer Release Notes
    AMD APP SDK v3.0 Beta Developer Release Notes 1 What’s New in AMD APP SDK v3.0 Beta 1.1 New features in AMD APP SDK v3.0 Beta AMD APP SDK v3.0 Beta includes the following new features: OpenCL 2.0: There are 20 samples that demonstrate various features of OpenCL 2.0 such as Shared Virtual Memory, Platform Atomics, Device-side Enqueue, Pipes, New workgroup built-in functions, Program Scope Variables, Generic Address Space, and OpenCL 2.0 image features. For the complete list of the samples, see the AMD APP SDK Samples Release Notes (AMD_APP_SDK_Release_Notes_Samples.pdf) document. Support for Bolt 1.3 library. 6 additional samples that demonstrate various APIs in the Bolt C++ AMP library. One new sample that demonstrates the consumption of SPIR 1.2 binary. Enhancements and bug fixes in several samples. A lightweight installer that supports the following features: Customized online installation Ability to download the full installer for install and distribution 1.2 New features for AMD CodeXL version 1.6 The following new features in AMD CodeXL version 1.6 provide the following improvements to the developer experience: GPU Profiler support for OpenCL 2.0 API-level debugging for OpenCL 2.0 Power Profiling For information about CodeXL and about how to use CodeXL to gather performance data about your OpenCL application, such as application traces and timeline views, see the CodeXL home page. Developer Release Notes 1 of 4 2 Important Notes OpenCL 2.0 runtime support is limited to 64-bit applications running on 64-bit Windows and Linux operating systems only.
    [Show full text]
  • The Compute Shader
    AMD Entering the Golden Age of Heterogeneous Computing Michael Mantor Senior GPU Compute Architect / Fellow AMD Graphics Product Group [email protected] 1 The 4 Pillars of massively parallel compute offload •Performance M’Moore’s Law Î 2x < 18 Month s Frequency\Power\Complexity Wall •Power Parallel Î Opportunity for growth •Price • Programming Models GPU is the first successful massively parallel COMMODITY architecture with a programming model that managgped to tame 1000’s of parallel threads in hardware to perform useful work efficiently 2 Quick recap of where we are – Perf, Power, Price ATI Radeon™ HD 4850 4x Performance/w and Performance/mm² in a year ATI Radeon™ X1800 XT ATI Radeon™ HD 3850 ATI Radeon™ HD 2900 XT ATI Radeon™ X1900 XTX ATI Radeon™ X1950 PRO 3 Source of GigaFLOPS per watt: maximum theoretical performance divided by maximum board power. Source of GigaFLOPS per $: maximum theoretical performance divided by price as reported on www.buy.com as of 9/24/08 ATI Radeon™HD 4850 Designed to Perform in Single Slot SP Compute Power 1.0 T-FLOPS DP Compute Power 200 G-FLOPS Core Clock Speed 625 Mhz Stream Processors 800 Memory Type GDDR3 Memory Capacity 512 MB Max Board Power 110W Memory Bandwidth 64 GB/Sec 4 ATI Radeon™HD 4870 First Graphics with GDDR5 SP Compute Power 1.2 T-FLOPS DP Compute Power 240 G-FLOPS Core Clock Speed 750 Mhz Stream Processors 800 Memory Type GDDR5 3.6Gbps Memory Capacity 512 MB Max Board Power 160 W Memory Bandwidth 115.2 GB/Sec 5 ATI Radeon™HD 4870 X2 Incredible Balance of Performance,,, Power, Price
    [Show full text]
  • Catalyst™ Software Suite Version 9.5 Release Notes
    Catalyst™ Software Suite Version 9.5 Release Notes This release note provides information on the latest posting of AMD’s industry leading software suite, Catalyst™. This particular software suite updates both the AMD Display Driver, and the Catalyst™ Control Center. This unified driver has been further enhanced to provide the highest level of power, performance, and reliability. The AMD Catalyst™ software suite is the ultimate in performance and stability. For exclusive Catalyst™ updates follow Catalyst Maker on Twitter. This release note provides information on the following: z Web Content z AMD Product Support z Operating Systems Supported z New Features z Performance Improvements z Resolved Issues for the Windows Vista Operating System z Resolved Issues for the Windows XP Operating System z Resolved Issues for the Windows 7 Operating System z Known Issues Under the Windows Vista Operating System z Known Issues Under the Windows XP Operating System z Known Issues Under the Windows 7 Operating System z Installing the Catalyst™ Vista Software Driver z Catalyst™ Crew Driver Feedback ATI Catalyst™ Release Note Version 9.5 1 Web Content The Catalyst™ Software Suite 9.5 contains the following: z Radeon™ display driver 8.612 z HydraVision™ for both Windows XP and Vista z HydraVision™ Basic Edition (Windows XP only) z WDM Driver Install Bundle z Southbridge/IXP Driver z Catalyst™ Control Center Version 8.612 Caution: The Catalyst™ software driver and the Catalyst™ Control Center can be downloaded independently of each other. However, for maximum stability and performance AMD recommends that both components be updated from the same Catalyst™ release.
    [Show full text]
  • AMD APP SDK V2.9.1 Developer Release Notes
    AMD APP SDK v2.9.1 Developer Release Notes 1 What’s New in AMD APP SDK v2.9.1 1.1 New features in AMD APP SDK v2.9.1 AMD APP SDK v2.9.1 includes the following new features: The AMD APP SDK can now be installed on Linux with root as well as non-root permissions. The installation logs display additional details about the status of the installation. Several samples have been enhanced. All the samples are now compatible with the gcc version, 4.8.1. The APARAPI samples have been updated to work with the latest APARAPI (OpenCL trunk) library. The OpenCV-CL samples now work with the OpenCV 2.4.9 library. The AMD APP SDK Bolt samples have been updated to work with the Bolt 1.2 library. For information about the features released in AMD APP SDK v2.9, see the AMD APP SDK v2.9 Developer Release Notes document. 1.2 Key features supported in the AMD Catalyst 14.4 driver Support for Kaveri graphics AMD Radeon R5/R6/R7 Support for AMD Radeon R9 295X Full support for OpenGL 4.4 Support for the following operating systems: Windows 8.1 (32- and 64-bit versions) Windows 7 (32- and 64-bit versions with SP1 or higher) 1.3 New features for AMD CodeXL version 1.4 The following new features for AMD CodeXL version 1.4 provide the following improvements to the developer experience: Microsoft Visual Studio 2013 CodeXL Extension New Shader Analyzer Support for Volcanic Islands family GPUs: debugging, profiling and analyzing.
    [Show full text]
  • AMD Codexl 1.8 GA Release Notes
    AMD CodeXL 1.8 GA Release Notes Contents AMD CodeXL 1.8 GA Release Notes ......................................................................................................... 1 New in this version .............................................................................................................................. 2 System Requirements .......................................................................................................................... 2 Getting the latest Catalyst release ....................................................................................................... 4 Note about installing CodeAnalyst after installing CodeXL for Windows ............................................... 4 Fixed Issues ......................................................................................................................................... 4 Known Issues ....................................................................................................................................... 5 Support ............................................................................................................................................... 6 Thank you for using CodeXL. We appreciate any feedback you have! Please use the CodeXL Forum to provide your feedback. You can also check out the Getting Started guide on the CodeXL Web Page and the latest CodeXL blog at AMD Developer Central - Blogs This version contains: For 64-bit Windows platforms o CodeXL Standalone application o CodeXL Microsoft® Visual Studio®
    [Show full text]
  • Codexl 2.6 GA Release Notes
    CodeXL 2.6 GA Release Notes Contents CodeXL 2.6 GA Release Notes ....................................................................................................................... 1 New in this version .................................................................................................................................... 2 System Requirements ............................................................................................................................... 2 Getting the latest Radeon™ Software release .......................................................................................... 3 Radeon software packages can be found here: .................................................................................... 3 Fixed Issues ............................................................................................................................................... 3 Known Issues ............................................................................................................................................. 4 Support ..................................................................................................................................................... 5 Thank you for using CodeXL. We appreciate any feedback you have! Please use the CodeXL Issues Page to provide your feedback. You can also check out the Getting Started guide and the latest CodeXL blog at GPUOpen.com This version contains: • For 64-bit Windows® platforms o CodeXL Standalone application o CodeXL Remote Agent
    [Show full text]