General Purpose Computing
Though GPUs were originally developed for graphical-processing, their parallelism and speed facilitatd the development of general-purpose GPU computing (GPGPU), non-graphics applications of GPUs implemented to speed up programs. Since its unveiling in 2001, GPGPU programming has spawned a host of programming paradigms that give users access to their GPU through API allowing them to customize function. GPGPU programming finds various applications from DNA analysis, search algorithms, and molecular simulations.
What the listed applications have in common is parallelism and throughput. These take advantage of GPU to process many simple elements in parallel at great speeds. This is incredibly ideal for molecular simulations, but also useful for image processing, especially on the pixel level.
GPGPU Access
There exist several common libraries to facilitate GPGPU programming. These include the Nvidia's CUDA and Khronos Group's OpenCL. Both libraries require downloads from the web and in Nvidia's case a special compiler, nvcc. OpenCL is open-source and has support on Intel, AMD, Nvidia, and ARM platforms. While CUDA is proprietary, it is well-supported by NVidia and widely used. Furthermore, taking into account
CUDA (Compute Unified Device Architecture) is an Nvidia-produced GPGPU API designed for nonspecialists. CUDA interacts directly with GPU threads and allows users to specify what threads they want to be executed in parallel as well as if they would like for it to be executed on multiple GPUs. Nvidia also provides CUDA support in the form of the CUDA Toolkit, providing parallel algorithm support, CUDA signal processing, and CUDA linear algebra libraries. This allows CUDA code to be easily fitted upon the existing C code.
Of course, not all programmers are necessarily interested in diving into CUDA programming, and there are other interfaces to take command of the GPU. Some commonly applied libraries are OpenCL, OpenACC, Numba, and CUDA. These libraries allow programmers to have easy access to the GPU, and also allows them to execute traditional GPU applications, granting them powerful control over the specific application of the GPU. Numba is a python library with inbuilt functions that allow quick and easy access to the GPU, with specific lines to specify the parts of code to be executed in parallel. Numba is based around the syntax of NumPy and Scipy, common libraries for handling the representation of code as matrices for mathematical computation. Numba compiles simultaneously for the CPU and the GPU and dramatically increases array processing.
OpenACC provides similar support, though in the C language. OpenACC accomplishes parallel programming via a series of simple, easy-to-understand preprocessor directives. Once the environment has been properly set up, the parallelism is fairly straight-forward to achieve. However, OpenACC isn’t simply restricted to these low-level applications, and is powerful enough to give users control over the ways they desire to parallelize loops and allocate data.