# 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
The following abbreviations are used in this manuscript: \begin{tabular}{l l} HPC & high-performance computing \\ ESM & earth system model \\ GPU & graphics processing unit \\ CPU & central processing unit \\ CUDA & compute unified device architecture \\ GCM & general circulation model \\ LBLRTM & line-by-line radiative transfer model \\ RRTM & rapid radiative transfer model \\ RRTMG & rapid radiative transfer model for general circulation models \\ CAS-ESM & Chinese Academy of Sciences-Earth System Model \\ IAP & Institute of Atmospheric Physics \\ IAP & ACGM4.0 & IAP Atmospheric General Circulation Model Version 4.0 \\ RRTMG_LW & RRTMG long-wave radiation scheme \\ G-RRTMG_LW & GPU version of the RRTMG_LW \\ WRF & Weather Research and Forecasting model \\ RRTM_LW & RRTM long-wave radiation scheme \\ RRTMG_SW & RRTMG shortwave radiation scheme \\ HOMME & High-Order Methods Modeling Environment \\ AER & Atmospheric and Environmental Research \\ RRTM_SW & RRTM shortwave radiation scheme \\ McICA & Monte-Carlo Independent Column Approximation \\ SM & streaming multiprocessor \\ SP & streaming processors \\
1-D & one-dimensional \\
2-D & two-dimensional \\ \end{tabular} 

## Appendix A

### Implementation of the Other Kernels Based on CUDA Fortran in 1-D Decomposition
```
attributes(global) subroutine\(\mathit{cldprmc\_d}\)(parameters)
1. iplon = (blockIdx%x\(-\)1) \(\times\) blockDim%x + threadIdx%x
2.if (iplon\(\geq\)1.and.iplon\(\leq\)ncol) then
3. Initialize variable arrays
4.do lay = 1, nlayers
5.do ig = 1, ngptlw
6.do some corresponding work
7.enddo
8.enddo
9.endif end subroutine
```
**Algorithm A1**Implementation of \(\mathit{cldprmc\_d}\) based on CUDA Fortran in 1-D decomposition. ```
attributes(global) subroutine\(\mathit{setcoef\_d}\)(parameters)
1. iplon=(blockIdx%x\(-\)1) \(\times\) blockDim%x+threadIdx%x
2.if (iplon\(\geq\)1.and.iplon\(\leq\)ncol) then
3. Initialize variable arrays //Calculate the integrated Planck functions for each band at the surface, level, and layer //temperatures
4.do lay = 1, nlayers
5.do iband = 1, 16
6.do some corresponding work
7.enddo
8.end if end subroutine
```
**Algorithm A2**Implementation of \(\mathit{setcoef\_d}\) based on CUDA Fortran in 1-D decomposition. ```
**Algorithm A3**Implementation of _taumol_d_ based on CUDA Fortran in 1-D decomposition. ```
attributes(global) subroutine tauol_d(parameters)
1. iplon=(blockIdx%x\(-\)1) \(\times\) blockDim%x+threadIdx%x
2. if(iplon\(\geq\)1.and.iplon\(\leq\)ncol) then //Calculate gaseous optical depth and Planck fractions for each spectral band



nd if end subroutine  attributes(device) subroutine taugb1_d(parameters) //Lower atmosphere loop //laytrop is tropopause layer index
1. do lay = 1, laytrop(iplon) //ng1 is an integer parameter used for 140 g-point model
2. do ig = 1, ng1
3. do some corresponding work
4. end do //Upper atmosphere loop
6. do lay = laytrop(iplon)+1, nlayers
7. do ig = 1, ng1
8. do some corresponding work
9. end do
10.end do  end subroutine
```  
**Algorithm A3**Implementation of _taumol_d_ based on CUDA Fortran in 1-D decomposition. ```
**Algorithm A4**Implementation of _rtrtnmc_d_ based on CUDA Fortran in 1-D decomposition. ``` attributes(global) subroutine\(rtnmc\_d\)(parameters)
1. iplon=(blockIdx%x\(-\)1) \(\times\) blockDim%x+threadIdx%x
2. if(iplon\(\geq\)1.and.iplon\(\leq\)ncol) then
3. Initialize variable arrays
4. do lay = 1, nlayers
5. do ig = 1, ngptlw
6. do some corresponding work
7. end do
8. end do //Loop over frequency bands //istart is beginning band of calculation //iend is ending band of calculation
9. do iband = istart, iend //Downward radiative transfer loop
10. do lay = nlayers, 1, -1
11. do some corresponding work
12. end do
13. end do
14.end if end subroutine ```
**Algorithm A5**Implementation of _setcoef_d_ based on CUDA Fortran in 2-D decomposition. _Append_