December 8, 2010

Readings digest. November 2010

It was not so much of free time in November, so I read only one computer-relater book...

Programming Massively Parallel Processors: A Hands-on Approach

To check some of my hypothesis, I decided to play with general-purpose programming for graphics processing units (GPU). I already knew about them, but wanted to make my knowledge deeper, so I obtained the Programming Massively Parallel Processors: A Hands-on Approach book, that should be good introduction into GPU's programming, according to reviews.

The first two chapters describe history of general-purpose programing on GPU, its architecture, and also describe different approaches to parallel programming.

Description of CUDA begins from third chapter. First, structure of CUDA programs is described, and than simple example is shown — multiplication of two matrices. This example will be used in all chapters and will improved as we'll switch to more complex topics. And the third chapter is finished with description of CUDA memory model and CUDA threads together with kernel functions.

Fourth chapter is completely dedicated to CUDA threads — how they are selected for scheduling, how they are organized into thread blocks, how to organize synchronization between threads. And fifth chapter describes all types of memory available for developer, and how these types could be used, taking into account different things, such as performance, etc.

Sixth chapter describes how programs could be optimized — how to achieve full load of processor and memory bus, how to organize data pre-fetching, etc. And seventh chapter is dedicated to problems, related to use of floating-point numbers.

The 8th and 9th chapters are used to show how to use CUDA for real projects. For each of projects, architecture of program is shown, together with description how data are organized, how kernel function is implemented, etc.

The 10th chapter is more philosophical — authors are trying to describe common patterns and approaches to problem solving and algorithms selection for parallel programs.

The eleventh chapter contains short description of OpenCL language with list of differences between it and CUDA. But description is very small, so it's better to look into official documentation of OpenCL, although the book provides very good base for future study.

Conclusion: If you want to become initial knowledge about general-purpose GPU programming, then you can take this book. It contains basic information about GPU's architecture, programming with CUDA, and also many advices on how to develop effective programs for GPU. Besides this, each chapter contains references section that you can use to find additional sources of information. If you want to get more deep understanding of CUDA programming, then you can take the CUDA by Example: An Introduction to General-Purpose GPU Programming book and/or official CUDA documentation.

Future work

I personally more interested in OpenCL, as it could be used from other languages, not only from C. For example, there is the Calx projects, that allows to run OpenCL code from programs written in Clojure. And OpenCL is also working not only on NVidia's hardware. I'm waiting for release of following books in next year: OpenCL in Action (already available as MEAP) and OpenCL Programming Guide, that should contain very useful information.

Additional resources

The very useful resource is the GPGPU site, where GPU-related articles and announcements are regularly published. For example, following articles was very useful for me: GrAVity: A Massively Parallel Antivirus Engine и Regular Expression Matching on Graphics Hardware for Intrusion Detection, because they are related to some of my investigations.

There are also at least two GPU-related courses on iTunesU. And materials of following course are also available.

And there are a lot of documentation and tutorials you can find on NVidia's site — both for CUDA, and OpenCL.

No comments: