OpenCL in Action
eBook - ePub

OpenCL in Action

Matthew Scarpino

Buch teilen
  1. English
  2. ePUB (handyfreundlich)
  3. Über iOS und Android verfĂŒgbar
eBook - ePub

OpenCL in Action

Matthew Scarpino

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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.

HĂ€ufig gestellte Fragen

Wie kann ich mein Abo kĂŒndigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kĂŒndigen“ – ganz einfach. Nachdem du gekĂŒndigt hast, bleibt deine Mitgliedschaft fĂŒr den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich BĂŒcher herunterladen?
Derzeit stehen all unsere auf MobilgerĂ€te reagierenden ePub-BĂŒcher zum Download ĂŒber die App zur VerfĂŒgung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die ĂŒbrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den AboplÀnen?
Mit beiden AboplÀnen erhÀltst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst fĂŒr LehrbĂŒcher, bei dem du fĂŒr weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhĂ€ltst. Mit ĂŒber 1 Million BĂŒchern zu ĂŒber 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
UnterstĂŒtzt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nÀchsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist OpenCL in Action als Online-PDF/ePub verfĂŒgbar?
Ja, du hast Zugang zu OpenCL in Action von Matthew Scarpino im PDF- und/oder ePub-Format sowie zu anderen beliebten BĂŒchern aus Computer Science & Parallel Programming. Aus unserem Katalog stehen dir ĂŒber 1 Million BĂŒcher zur VerfĂŒgung.

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...

Inhaltsverzeichnis