Book Image

Haskell High Performance Programming

By : Samuli Thomasson
Book Image

Haskell High Performance Programming

By: Samuli Thomasson

Overview of this book

Haskell, with its power to optimize the code and its high performance, is a natural candidate for high performance programming. It is especially well suited to stacking abstractions high with a relatively low performance cost. This book addresses the challenges of writing efficient code with lazy evaluation and techniques often used to optimize the performance of Haskell programs. We open with an in-depth look at the evaluation of Haskell expressions and discuss optimization and benchmarking. You will learn to use parallelism and we'll explore the concept of streaming. We’ll demonstrate the benefits of running multithreaded and concurrent applications. Next we’ll guide you through various profiling tools that will help you identify performance issues in your program. We’ll end our journey by looking at GPGPU, Cloud and Functional Reactive Programming in Haskell. At the very end there is a catalogue of robust library recommendations with code samples. By the end of the book, you will be able to boost the performance of any app and prepare it to stand up to real-world punishment.
Table of Contents (21 chapters)
Haskell High Performance Programming
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Chapter 11. Programming for the GPU with Accelerate

In recent years, Graphics Processing Units (GPUs) have become prominent hardware in areas other than just plain graphics applications. This practice is known as General-Purpose Computing On Graphics Processing Units (GPGPU). Due to their ability to perform highly parallel computations much more efficiently compared to a CPU, the GPU is often utilized, for instance, in machine-learning applications. The GPU is specialized to perform certain kinds of vectorized computations extremely efficiently. It's not nearly as flexible as a CPU is. Single cores in a GPU are far less powerful than CPU cores, but there are hundreds of smaller cores in a GPU.

Due to their parallel nature, GPUs use wildly different instruction sets than, say, the x86. The two dominant ways of writing programs that run on the GPU are Nvidia's proprietary CUDA platform and OpenCL, which is an open source framework and standard for writing programs that run on heterogeneous...