OpenCL in Action
eBook - ePub

OpenCL in Action

Matthew Scarpino

Compartir libro
  1. English
  2. ePUB (apto para móviles)
  3. Disponible en iOS y Android
eBook - ePub

OpenCL in Action

Matthew Scarpino

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

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.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es OpenCL in Action un PDF/ePUB en línea?
Sí, puedes acceder a OpenCL in Action de Matthew Scarpino en formato PDF o ePUB, así como a otros libros populares de Computer Science y Parallel Programming. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
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...

Índice