Matrix Computations on the GPU with ArrayFire for Python and C/C++

by Andrzej Chrzȩszczyk of Jan Kochanowski University

Phone: +1.800.570.1941 • [email protected] • www.accelereyes.com The “AccelerEyes” logo is a trademark of AccelerEyes.

Foreward by John Melonakos of AccelerEyes

One of the biggest pleasures we experience at AccelerEyes is watching programmers develop awesome stuff with ArrayFire. Oftentimes, ArrayFire programmers contribute back to the community in the form of code, examples, or help on the community forums.

This document is an example of an extraordinary contribution by an ArrayFire programmer, written entirely by Andrzej Chrzȩszczyk of Jan Kochanowski University. Readers of this document will find it to be a great resource in learning the ins-and-outs of ArrayFire.

On behalf of the rest of the community, we thank you Andrzej for this marvelous contribution.

Phone: +1.800.570.1941 • [email protected] • www.accelereyes.com The “AccelerEyes” logo is a trademark of AccelerEyes.

Foreward by Andrzej Chrzȩszczyk of Jan Kochanowski University

In recent years the Graphics Processing Units (GPUs) designed to efficiently manipulate are more and more often used to General Purpose computing on GPU (GPGPU). NVIDIA’s CUDA and OpenCL platforms allow for general purpose parallel programming on modern graphics devices. Unfortunately many owners of powerful graphic cards are not experienced programmers and can find these platforms quite difficult. The purpose of this document is to make the first steps in using modern graphics cards to general purpose computations simpler.

In the first two chapters we want to present the ArrayFire software library which in our opinion allows to start computations on GPU in the easiest way. The necessary software can be downloaded from:

 http://www.accelereyes.com/products/arrayfire

In the present text we describe the ArrayFire 1.1 free version. It allows for efficient dense matrix computations in single precision on single GPU. The readers interested in double precision linear algebra, multiple GPUs, or sparse matrices should consider ArrayFire Pro.

Phone: +1.800.570.1941 • [email protected] • www.accelereyes.com The “AccelerEyes” logo is a trademark of AccelerEyes.