# A Novel GPU-Based Acceleration Algorithm for a Longwave Radiative Transfer Model
## 5 Algorithm Implementation
### trrnmc_d
In the future, compressing data and improving the network bandwidth will be beneficial for reducing this I/O transfer cost. \begin{table}
\begin{tabular}{c c c c} \hline
**Subroutines** & **CPU Time (S)** & **K20 Time (S)** & **Speedup** \\ \hline _intatm_ & 150.48 & 1.7224 & **87.37** \\ _cldpmc_ & 5.27 & 0.0020 & 2635.00 \\ _sectcoef_ & 14.52 & 0.3360 & 43.21 \\ _taumol_ & 169.68 & 4.1852 & 40.54 \\ _rtrunmc_ & 252.80 & 19.1580 & **13.20** \\ _rtrng\_lw_ & 647.12 & 25.4036 & **25.47** \\ \hline
**Subroutines** & **CPU Time (S)** & **K40 Time (S)** & **Speedup** \\ \hline _intatm_ & 150.48 & 1.5140 & **99.39** \\ _cldpmc_ & 5.27 & 0.0020 & 2635 \\ _sectcoef_ & 14.52 & 0.2480 & 58.55 \\ _taumol_ & 169.68 & 3.1524 & 53.83 \\ _rtrunmc_ & 252.80 & 15.9712 & **15.83** \\ _rtrng\_lw_ & 647.12 & 20.8876 & **30.98** \\ \hline \end{tabular}
\end{table} 
Table 4: Runtime and speedup of the G-RRTMG_LW on one GPU. Here, the block size = 512 and \(ncol\) = 2048; _intatm_ and _rtrunmc_ are with an acceleration in the _g-point_ dimension; _cldprmc_ is with a 1D decomposition; _sectcoef_ and _taumol_ are with a 2D decomposition. \begin{table}
\begin{tabular}{c c c c} \hline
**Subroutines** & **CPU Time (S)** & **K20 Time (S)** & **Speedup** \\ \hline _rtrng\_lw_ & 59.79 & 25.4036 & **2.35** \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Runtime and speedup of the G-RRTMG_LW on one GPU when compared to its counterpart running on 10 CPU cores of an Intel Xeon E5-2680 v2. Here, the block size = 512 and \(ncol\) = 2048; _inatm_ and _rtrunmc_ are with an acceleration in the _g-point_ dimension; _cldprmc_ is with a 1D decomposition; _sectcoef_ and _taumol_ are with a 2D decomposition. ### Error Analysis

During accelerating the computational performance of a climate system model, it is of vital importance to ensure that the model on one GPU can generate the same results within a small tolerance threshold. In this simulating experiment, Figure 7 illustrates the impact on the longwave flux at the top of the atmosphere in a clear sky. The outgoing longwave flux by running entirely the CAS-ESM RRTMG_LW on the CPU is shown in Figure 7a. The longwave flux differences between the simulations running the CAS-ESM RRTMG_LW only on the CPU and running the CAS-ESM RRTMG_LW (G-RRTMG_LW) on the K20 GPU is shown in Figure 7b. The results show that there are minor and negligible differences. Besides the impact of running the G-RRTMG_LW on the GPU, the impact of the slight physics change by running the G-RRTMG_LW code on the GPU also results in these differences. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Subroutines** & **CPU Time (S)** & **K20 Time (S)** & **Speedup** \\ \hline _rrtmg\_lw_ & 647.12 & 86.79 & **7.46** \\ \hline
**Subroutines** & **CPU Time (S)** & **K40 Time (S)** & **Speedup** \\ \hline _rrtmg\_lw_ & 647.12 & 80.19 & **8.07** \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Runtime and speedup of the G-RRTMG_LW with I/O transfer on one GPU, where the block size = 512 and _ncol_ = 2048. Figure 7: Impact on the longwave flux at the top of the atmosphere in a clear sky. (**a**) Longwave flux simulated by the CAS-ESM RRTMG_LW on the CPU; (**b**) Longwave flux differences between the simulations running the CAS-ESM RRTMG_LW only on the CPU and running the CAS-ESM RRTMG_LW on the GPU. ## 7 Conclusions and Future Work

It is exceedingly challenging to use GPUs to accelerate radiation physics. In this work, a GPU-based acceleration algorithm of the RRTMG_LW in the _g-point_ dimension was proposed. Then, the acceleration algorithm was implemented using CUDA Fortran. Finally, G-RRTMG_LW, the GPU version of the RRTMG_LW, was developed. The results indicated that the algorithm was effective. During the climate simulation for one model day, the G-RRTMG_LW on one K40 GPU achieved a speedup of 30.98\(\times\) as compared with a single Intel Xeon E5-2680 CPU-core counterpart. Its runtime decreased from 647.12 s to 20.8876 s. Running the G-RRTMG_LW on one GPU presented a better computing performance than on a CPU with multiple cores.