# cuda and numerical methods with implicit time discretization

I am looking to port some code that resolves a set of partial differential equations (PDE) by the finite volume method in IMPLICIT form (for the time discretization).

As result there is a tridiagonal system of equations in x,y,z directions which is handled by the ADI/TDMA scheme.

I can not seem to find anything regarding implicit solution of PDEs with CUDA.

Is the ADI/TDMA scheme possible to implement in CUDA?? Is there an example like 2D heat diffusion equation available somewhere??

All I could find is a CUDA sample code for 2D heat diffusion equation in finite differences but in EXPLICIT form (University of Cambridge).

Any hint/reference would be greatly appreciated.

• What kind of PDEs are you working with? Is this linear, nonlinear? Is your whole system tridiagonal? (I don't understand what you meant by 'tridiagonal in x,y,z directions'). In general it is hard to implement sparse solvers or iterative solvers on GPU because of globalized inner products and irregular communication (but communication may be less of an issue if this is tridiagonal). Edit: Ok googled ADI, never used it before myself. Quick google on tridiagonal solvers though found this: impact.crhc.illinois.edu/shared/papers/sc12_tridiagonal-1.pdf May 14, 2013 at 1:48
• Thank you for the link. The PDEs are from conservation equations of momentum, mass and energy so they are strongly coupled and non-linear. Seems that mr Nikolai Sakharnykh has done it already. Here is the link for the interested: nvidia.com/content/GTC/documents/1058_GTC09.pdf. Can not find a sample code though, that would really help. May 17, 2013 at 3:23
• Please delete your duplicate posting on SO, or ask for it to be migrated here. May 19, 2013 at 5:43

## 1 Answer

This problem lends itself to a highly vectorized form. As you noted, the ADI method gives a few steps of tridiagonal systems. Since it's in the form of linear equations, you can use CUsolver and CUblas to call parallel GPU versions of standard linear algebra routines. Using these, you should be able to take the explicit code and just change the inner loop to an appropriate CUsolver call and solve it in a way where the code looks almost exactly like a CPU implementation, but with the matrix operations done on the GPUs via library calls.