Introduction To GPU Compute

You need the following Simdify® modules to complete this exercise: Simdify® Free Edition, Simdify® Compute Module, Simdify® Buffer Module

In this series of exercises, you'll learn how to build a service for analyzing terrain, and we will teach you to implement features that make this service capable of performing large-scale compute workloads. We'll do this through the lens of a tough and interesting geophysical problem—avalanche terrain analysis—that is well-suited to optimization with GPU compute. And we'll do this without writing a single line of C++ code.

Figure 1.1. Sample Terrain Analysis.

A sample terrain report.

This series teaches you how to build a service that creates reports like this. ( View Sample Report )

You'll learn techniques that are useful for writing compute services, including how to design abstractions, how to write and structure Simdify Scripting Language code, and how to bring it all together to do real work.

Throughout these exercises, you'll notice that we refer to CPU and GPU compute. Most GPU compute applications are a hybrid of CPU and GPU compute, with variations in the thickness of the CPU compute layer. In this case, we are going to use a fairly thick CPU compute layer because the service benefits greatly from being able to use CPU code, and some elements aren't really suited for GPU compute. For example, we start out with GEOTIFF source data, and we use CPU compute to assemble large array textures that can be fed to the GPU once, processed with compute shaders, and then read back from the GPU. It's much easier, and much more practical, to use CPU compute code for some of these tasks, especially when you can use CPU compute code to improve the results of GPU compute.

Before we continue, let's review the hardware and software requirements for this series. Except for compute shader support, these requirements aren't absolute, but using less capable hardware can make the CPU and GPU compute operations take longer.

Table 1.1. Hardware and Software Requirements.

Requirement Description
Text Editor While you can complete these exercises using Notepad, it will be difficult to do so. We recommend a text editor with support for undo/redo, and multiple documents, such as Notepad++, Visual Studio, Visual Studio Code, or Sublime Text. All the recommended editors have great syntax highlighting for Simdify Scripting Language if you use C++ highlighting on .SSL files.
CPU Memory At least 16GB of CPU memory. Octopus memory use peaks at around 10GB when processing an entire GEOTIFF.
GPU Memory At least 4GB of GPU memory. GPU memory use peaks at around 1GB per shader when processing an entire GEOTIFF.
Hard Disk At least 16GB of hard disk, depending on how much data you acquire and submit as compute workloads.
Compute Shaders Your OpenGL hardware and driver must have robust support for compute shaders, imageLoad/imageStore, and shader storage buffers. Any graphics card as recent as 2018 should have enough features to complete these exercises.