Reprinted from: http://blog.sina.com.cn/s/blog_a43b3cf2010157ph.html
There are several ways to write parallel programs that utilize GPU acceleration, which are summed up in three ways:
1. Take advantage of the existing GPU function library.
Nvidia's Cuda Toolbox improves free GPU-accelerated fast Fourier transform (FFT), Basic linear algebra subroutines (BLAST), image and video processing library (NPP). The user can get performance acceleration by replacing the fast Fourier transform, fast Fourier transform and image and video processing library of the CPU version in the source code with the corresponding GPU version. In addition to the function libraries provided by NVIDIA, the third-party GPU libraries are: CUDA data parallel Primitives (CUDPP) Cula tool: Launched by EM Photonics, lapack MAGMA in Cuda GPU: Launched by Dongarra's group , lapack Jacobian preprocessing conjugate gradient (JCG) gpulib in CUDA GPU and multicore CPUs: GPU VSIPL Signal Processing Library Computer Vision (CV) and Imaging library for Interface Description Language (IDL) and Matrix Lab (MATLAB) Opencurrent: Cuda Accelerated PDE (partial differential equation, partial differential equations) in the regular grid system LIBSVM MULTISVM in Open source database solution Cuda/gpu: Multi-level SVM with Cuda CUSVM: Cuda usage support for vector classification and attenuation
2. CUDA programming.
This is the most common and appropriate approach, and Cuda maximizes the GPU's acceleration performance.
3. Instruction (Directive) programming.
Based on the OPENACC standard, GPU directive programming is an easy and effective way to speed up scientific or industrial code. By using GPU instructions, simply inserting the compilation instructions into your source code, the compiler will automatically map the compute-intensive portions of the code to the GPU, speeding up your coding. Here is a simple example of how to speed up the calculation of pi with an instruction. Using GPU instructions, you can quickly get started and see the results on the day.
Advantages of OPENACC Programming:
L Simple: Just insert the build hint in your code
L Open: A single codebase can be run on both the CPU and the GPU
Powerful: It takes only a few hours to play the GPU's power
The leader of the parallel computing tool, PGI, caps and Cray, will be the first to support OPENACC.