To port an existing code tto cuda? where to start

Hi guys,
I am investigating if it is possible GitHub - sccn/amica: Code for AMICA: Adaptive Mixture ICA with shared components to nvidia GPU [ cuda];
It seems that Fortran porting will need to take place.
I am just wondering how difficult it might be and where to start.
Thank you for any insights.

Hi Andrey,

I took a quick look over the code as see that it’s mostly comprised calls to BLAS and LAPACK routines which you’d could port to use cuBLAS and cuSOLVER. cuBLAS is fairly complete, but cuSOLVER only supports a sub-set of LAPACK so be sure to check if the specific solvers you use are available.

Porting Fortran codes to use cuBLAS is fairly straight forward since we provide an interface modules. Though if the code’s only using small matrices and/or vectors, it may not be beneficial to keep the code as is. In this case, you may want to look into batching together several small calls at once. https://developer.nvidia.com/blog/cuda-pro-tip-how-call-batched-cublas-routines-cuda-fortran/

Calling cuSOLVER routines are a bit more challenging, but not too bad.

More info on CUDA Fortran can be found at: CUDA Fortran Programming Guide Version 22.7 for ARM, OpenPower, x86
with the CUDA Libraries interface modules at: NVIDIA Fortran CUDA Library Interfaces Version 22.7 for ARM, OpenPower, x86

-Mat

Thank you for your response!