SimFlowCFD / RapidCFD-dev

RapidCFD is an OpenFOAM fork running fully on CUDA platform. Brought to you by
https://sim-flow.com
Other
319 stars 93 forks source link

Adding matrix solver and preconditioners #79

Open klausbu opened 3 years ago

klausbu commented 3 years ago

I am thinking about adding additional linear algebra solvers and preconditioners to Rapid CFD. There are numerous linear algebra libraries that could be leveraged. Each library has it's specific implementation requirements so I have initial questions to get a better understanding of underlying concepts in RapidCFD.

Let's consider the multi GPU case with local data:

TonkomoLLC commented 3 years ago

Hello,

I have just limited experience here. I ported PBiCGStab to RapidCFD: My work product is located here.

It's also been nearly two years since I did this work, so my memory is a little fuzzy on the details. To the best of my recollection, I started with a CPU (vanilla OpenFOAM) version of PBiCGStab. Then, I found each instance of addition, subtraction, multiplication and division of matrices, using the most similar solver, PBiCG, as a guide on where to make changes.

As a warning: while I did some preliminary testing with icoFoam, I did not test this solver very thoroughly. I basically did this as an exercise to see how one would add a new linear solver.

I did not fully answer your question, but I hope that this practical example will help enable your valued development of new linear solvers and preconditioners. The project will greatly benefit from your developments.

Cheers,

Eric

klausbu commented 3 years ago

Your approach is one way of doing it, what I have in mind is to create an "interface" to matrix solvers and preconditioners provided by external libraries without doubling the memory footprint (LDU format + converted CSR format) on the GPU.

My approach requires to provide the local matrix/data with global indices in CSR format as a starting point.

TonkomoLLC commented 3 years ago

I do not have specific advice for you, but with respect to your earlier query,

which files or documents should I look at?

Probably a starting point is the src/OpenFOAM directory, and in particular, the matrices directory.

I hope this answers your first question. I do not know the answer to your second question, regarding a simple way to convert the ldu data structure on the GPU into CSR format without duplicating the data. Hopefully others are reading this thread and have answers for you.