OpenCL in Action
eBook - ePub

OpenCL in Action

Matthew Scarpino

Partager le livre
  1. English
  2. ePUB (adapté aux mobiles)
  3. Disponible sur iOS et Android
eBook - ePub

OpenCL in Action

Matthew Scarpino

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que OpenCL in Action est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  OpenCL in Action par Matthew Scarpino en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Parallel Programming. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2011
ISBN
9781617290176

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

Table des matiĂšres