concept OpenCL in category parallel computing

appears as: OpenCL
Parallel and High Performance Computing

This is an excerpt from Manning's book Parallel and High Performance Computing.

Figure 5.6 The algorithm speedup and the parallel speedup total 3157x. The new algorithm enables the parallel speedup on the GPU.
Neigh2dBar.png

How hard is the code to write for this kind of performance? Let’s take a look at the code for writing out the hash table as shown in listing 5.4 for the CPU. The input to the routine are the 1D arrays i, j, and level. Level is the refinement level; i and j are the row and column of the cell in the mesh at that cell’s refinement level. The whole listing is around a dozen lines on the CPU.

Figure 5.6 The algorithm speedup and the parallel speedup total 3157x. The new algorithm enables the parallel speedup on the GPU.
Neigh2dBar.png

OpenCL is the open standard for GPU programming and so we use it as the base terminology. OpenCL runs on all of the GPU hardware and many other devices such as CPUs and even more exotic hardware such as Field Programmable Gate Arrays (FPGAs) and other embedded devices. CUDA, the Nvidia proprietary language for their GPUs, is the most widely used language for GPU computation and thus used in a great fraction of the documentation on programming GPUs. HIP (Heterogeneous computing Interface for Portability) is a portable derivative of CUDA developed by AMD for their GPUs. It thus uses similar terminology as CUDA. The native AMD Heterogeneous Compute (HC) Compiler and the C++ AMP language from Microsoft use a lot of the same terms. (C++ AMP is in maintenance mode and not under active development). When trying to get portable performance, it’s also important to consider the corresponding features and terms for the CPU.

ln -s Makefile.perl Makefile
make
Listing 12.11 A simple makefile for HIP
HIP/StreamTriad/Makefile.perl
 1 all: StreamTriad
 2 
 3 CXX = hipcc    #A
 4 
 5 %.cc : %.cu    #B
 6    hipify-perl $^ > $@    #B
 7 
 8 StreamTriad: StreamTriad.o timer.o
 9    ${CXX} -o $@ $^
10 
11 clean:
12    rm -rf StreamTriad *.o StreamTriad.cc