Book Image

IPython Interactive Computing and Visualization Cookbook

By : Cyrille Rossant
Book Image

IPython Interactive Computing and Visualization Cookbook

By: Cyrille Rossant

Overview of this book

Table of Contents (22 chapters)
IPython Interactive Computing and Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing massively parallel code for heterogeneous platforms with OpenCL


In the previous recipe, we introduced CUDA, a proprietary GPGPU framework created by NVIDIA Corporation. In this recipe, we present OpenCL, an alternative open framework initiated by Apple in 2008. It is now adopted by mainstream companies including Intel, NVIDIA, AMD, Qualcomm, ARM, and others. These companies are regrouped within the non-profit technology consortium Khronos Group (which also maintains the OpenGL real-time rendering specification). Programs written in OpenCL can run on GPUs and CPUs (heterogeneous computing).

Note

CUDA and OpenCL are relatively similar in terms of concepts, syntax, and features. CUDA sometimes leads to slightly higher performance, since its API matches the hardware more closely than OpenCL's generic API.

We can use OpenCL in Python thanks to PyOpenCL, a Python package written by Andreas Klöckner (http://documen.tician.de/pyopencl/).

In this recipe, we will implement the Mandelbrot fractal...