# Using a GPU to Accelerate a Longwave Radiative Transfer Model with Efficient CUDA-Based Methods
## 4 GPU-Enabled Acceleration Algorithms
### Acceleration Algorithm with Two-Dimensional Domain Decomposition
#### 5.1.2 Evaluations on Different GPUs

The run-time and speedup of the 1-D G-RRTMG_LW on the K20 and K40 GPUs are shown in Table 2. The speedups of the 1-D \(inatm\), \(cldprmc\), \(setcoef\), \(taumol\), and \(rtrnmc\) on one K20 GPU were 7.36\(\times\), 2635.00\(\times\), 14.65\(\times\), 9.22\(\times\), and 11.83\(\times\), respectively. Using one K20 GPU in the case without I/O transfer, the 1-D G-RRTMG_LW achieved a speedup of 10.57\(\times\) compared to its counterpart running on one CPU core of an Intel Xeon E5-2680 v2 whereas, using one K40 GPU in the case without I/O transfer, the 1-D G-RRTMG_LW achieved a speedup of 14.62\(\times\). The K40 GPU had higher core clock and memory clock, more cores, and stronger floating-point computation power than the K20 GPU, so the 1-D G-RRTMG_LW on the K40 GPU showed better performance. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Subroutines** & **CPU Time (s)** & **K20 Time (s)** & **Speedup** \\ \hline \(inatm\) & 150.48 & 20.4440 & 7.36 \\ \(cldprmc\) & 5.27 & 0.0020 & 2635.00 \\ \(setcoef\) & 14.52 & 0.9908 & 14.65 \\ \(taumol\) & 169.68 & 18.3980 & 9.22 \\ \(rtrnmc\) & 252.80 & 21.3712 & 11.83 \\ \(rtr\)**mg\_Iw** & 647.12 & 61.206 & **10.57** \\ \hline
**Subroutines** & **CPU Time (s)** & **K40 Time (s)** & **Speedup** \\ \hline \(inatm\) & 150.48 & 15.3492 & 9.80 \\ \(cldprmc\) & 5.27 & 0.0016 & 3293.75 \\ \(setcoef\) & 14.52 & 0.8920 & 16.28 \\ \(taumol\) & 169.68 & 11.0720 & 15.33 \\ \(rtrnmc\) & 252.80 & 16.9344 & 14.93 \\ \(rtr\)**mg\_Iw** & 647.12 & 44.2492 & **14.62** \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Run-time and speedup of the 1-D G-RRTMG_LW on one GPU, where the block size = 16 and \(ncol\) = 2048. Figure 6: Run-time of the 1-D G-RRTMG_LW on one K40 GPU. ### Performance of 2-D G-RRTMG_LW

#### 5.2.1 Influence of Block Size

Taking the case of no I/O transfer as an example, Figure 7 portrays the run-time of the 2-D G-RRTMG_LW on one K20 GPU. The G-RRTMG_LW on one K20 GPU achieved optimal performance when the block size was 16. However, the 2-D G-RRTMG_LW on one K40 GPU achieved optimal performance when the block size was 32, as shown in Figure 8. The 2-D \(setcoef\) and \(taumol\) achieved a better speedup than their 1-D versions, but the 2-D \(inatm\) ran more slowly. From Figures 7 and 8, some conclusions and analysis are drawn as follows. 1. The 2-D \(inatm\) costs more computational time than its 1-D version. This indicated that \(inatm\) was not fit for 2-D acceleration. According to the testing, it was found that the assignment computing of four three-dimensional arrays in the 2-D \(inatm\) required about 95% of the computational time. In the 2-D acceleration, more CUDA threads were started. Each CUDA thread needs to finish the assignment computing of the four arrays using a do-loop form as shown in Algorithm 5, so the computing costs too much time. 2. The 2-D \(taumol\) achieved optimal performance when the block size was 256 or 512. During the 2-D acceleration, a larger number of threads were assigned, so each thread had fewer calculations, requiring fewer hardware resources. When the block size was 256 or 512, the assigned hardware

Figure 8: Run-time of the 2-D G-RRTMG_LW on one K40 GPU. Figure 7: Run-time of the 2-D G-RRTMG_LW on one K20 GPU. resources of each thread were in a state of equilibrium, so in this case, the 2-D _taumol_ showed better performance. #### 5.2.2 Evaluations on Different GPUs

The run-time and speedup of the 2-D G-RRTMG_LW on the K20 and K40 GPUs are shown in Table 3. Due to the poor performance of the 2-D _inatm_, its 1-D version was still used here. The speedups of the 2-D _setcoef_ and _taumol_ on one K20 GPU were 43.21\(\times\) and 40.54\(\times\), respectively. Using one K20 GPU in the case without I/O transfer, the 2-D G-RRTMG_LW achieved a speedup of 14.63\(\times\) compared to its counterpart running on one CPU core of an Intel Xeon E5-2680 v2 whereas, using one K40 GPU in the case without I/O transfer, the 2-D G-RRTMG_LW achieved a speedup of 18.52\(\times\).