eBook - ePub
OpenCL in Action
Matthew Scarpino
This is a test
Share book
- English
- ePUB (mobile friendly)
- Available on iOS & Android
eBook - ePub
OpenCL in Action
Matthew Scarpino
Book details
Book preview
Table of contents
Citations
About This Book
OpenCL in Action is a thorough, hands-on presentation of OpenCL, with an eye toward showing developers how to build high-performance applications of their own. It begins by presenting the core concepts behind OpenCL, including vector computing, parallel programming, and multi-threaded operations, and then guides you step-by-step from simple data structures to complex functions.
Frequently asked questions
How do I cancel my subscription?
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoâs features. The only differences are the price and subscription period: With the annual plan youâll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weâve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is OpenCL in Action an online PDF/ePUB?
Yes, you can access OpenCL in Action by Matthew Scarpino in PDF and/or ePUB format, as well as other popular books in Computer Science & Parallel Programming. We have over one million books available in our catalogue for you to explore.
Information
Part 1. Foundations of OpenCL programming
Part 1 presents the OpenCL language. Weâll explore OpenCLâs data structures and functions in detail and look at example applications
that demonstrate their usage in code.
Chapter 1 introduces OpenCL, explaining what itâs used for and how it works. Chapters 2 and 3 explain how host applications are coded, and chapters 4 and 5 discuss kernel coding. Chapters 6 and 7 explore the advanced topics of image processing and event handling.
Chapters 8 and 9 discuss how OpenCL is coded in languages other than C, such as C++, Java, and Python. Chapter 10 explains how OpenCLâs capabilities can be used to develop large-scale applications.
Chapter 1. Introducing OpenCL
This chapter covers
- Understanding the purpose and benefits of OpenCL
- Introducing OpenCL operation: hosts and kernels
- Implementing an OpenCL application in code
In October 2010, a revolution took place in the world of high-performance computing. The Tianhe-1A, constructed by Chinaâs National Supercomputing Center in Tianjin, came from total obscurity to seize the leading position among the worldâs best performing supercomputers. With a maximum recorded computing speed of 2,566 TFLOPS (trillion floating-point operations per second), it performs nearly 50 percent faster than the second-place finisher, Crayâs Jaguar supercomputer. Table 1.1 lists the top three supercomputers.
Table 1.1. Top three supercomputers of 2010 (source: www.top500.org)
Supercomputer | Max speed (TFLOPS) | Processors | Power (kW) |
---|---|---|---|
Tianhe-1A | 2,566 | 14,336 Intel Xeon CPUs, 7,168 Nvidia Tesla GPUs | 4040.00 |
Jaguar | 1,759 | 224,256 AMD Opteron CPUs | 6950.60 |
Nebulae | 1,271 | 9,280 Intel Xeon CPUs, 4,640 Nvidia Tesla GPUs | 2580.00 |
Whatâs so revolutionary is the presence of GPUs (graphics processing units) in both the Tianhe-1A and Nebulae? In 2009, none of the top three supercomputers had GPUs, and only one system in the top 20 had any GPUs at all. As the table makes clear, the two systems with GPUs provide not only excellent performance, but also impressive power efficiency.
Using GPUs to perform nongraphical routines is called general-purpose GPU computing, or GPGPU computing. Before 2010, GPGPU computing was considered a novelty in the world of high-performance computing and not worthy of serious attention. But today, engineers and academics are reaching the conclusion that CPU/GPU systems represent the future of supercomputing.
Now an important question arises: how can you program these new hybrid devices? Traditional C and C++ only target traditional CPUs. The same holds true for Crayâs proprietary Chapel language and the Cray Assembly Language (CAL). Nvidiaâs CUDA (Compute Unified Device Architecture) can be used to program Nvidiaâs GPUs, but not CPUs.
The answer is OpenCL (Open Computing Language). OpenCL routines can be executed on GPUs and CPUs from major manufacturers like AMD, Nvidia, and Intel, and will even run on Sonyâs PlayStation 3. OpenCL is nonproprietaryâitâs based on a public standard, and you can freely download all the development tools you need. When you code routines in OpenCL, you donât have to worry about which company designed the processor or how many cores it contains. Your code will compile and execute on AMDâs latest Fusion processors, Intelâs Core processors, Nvidiaâs Fermi processors, and IBMâs Cell Broadband Engine.
The goal of this book is to explain how to program these cross-platform applications and take maximum benefit from the underlying hardware. But the goal of this chapter is to provide a basic overview of the OpenCL language. The discussion will start by focusing on OpenCLâs advantages and operation, and then proceed to describing a complete application. But first, itâs important to understand OpenCLâs origin. Corporations have spent a great deal of time developing this language, and once you see why, youâll have a better idea why learning about OpenCL is worth your own.
1.1. The dawn of OpenCL
The x86 architecture enjoys a dominant position in the world of personal computing, but there is no prevailing architecture in the fields of graphical and high-performance computing. Despite their common purpose, there is little similarity between Nvidiaâs line of Fermi processors, AMDâs line of Evergreen processors, and IBMâs Cell Broadband Engine. Each of these devices has its own instruction set, and before OpenCL, if you wanted to program them, you had to learn three different languages.
Enter Apple. For those of you who have been living as recluses, Apple Inc. produces an insanely popular line of consumer electronic products: the iPhone, the iPad, the iPod, and the Mac line of personal computers. But Apple doesnât make processors for the Mac computers. Instead, it selects devices from other companies. If Apple chooses a graphics processor from Company A for its new gadget, then Company A will see a tremendous rise in market share and developer interest. This is why everyone is so nice to Apple.
Important events in OpenCL and multicore computing history
2001â IBM releases POWER4, the first multicore processor.
2005â First multicore processors for desktop computers released: AMDâs Athlon 64 X2 and Intelâs Pentium D.
June 2008â The OpenCL Working Group forms as part of the Khronos Group.
December 2008â The OpenCL Working Group releases version 1.0 of the OpenCL specification.
April 2009â Nvidia releases OpenCL SDK for Nvidia graphics cards.
August 2009â ATI (now AMD) releases OpenCL SDK for ATI graphics cards. Apple includes OpenCL support in its Mac OS 10.6 (Snow Leopard) release.
June 2010â The OpenCL Working Group releases version 1.1 of the OpenCL specification.
In 2008, Apple turned to its vendors and asked, âWhy donât we make a common interfa...