halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

Use ArrayFire #33

Closed matsievskiysv closed 3 years ago

matsievskiysv commented 3 years ago

ArrayFire provides fronted OpenGL/CUDA/CPU dense and sparse matrix manipulation functions. It actually uses BLAS for CPU computations, so there shouldn't be noticeable performance degradation compared with the current setup. Vectorized functions and algorithms may also be handy. The only potential problem is proper GPU driver support, so CPU should probably be used as a default backend.

halbux commented 3 years ago

I don't immediately see the need/added value to move away from openblas? There is no gpu acceleration support in sparselizard for now, and I don't think there will be in the medium term: except for explicit time resolutions, otherwise FEM calculations need too much memory per core for gpu to be interesting (that's my view on it, if you have proof of the opposite I am happy to have a look).

matsievskiysv commented 3 years ago

GPU acceleration is optional and may be enabled at runtime. ArrayFire benchmarks are pretty good and it has nice API. It may replace vector and matrix data structures with its array class which has builtin math functions and parallelization.

halbux commented 3 years ago

You mean replace the densemarix object? I don't think it is needed: blas is required by mumps anyways so using arrayfire would just be adding an extra dependency, which is something I really want to avoid. And anyways the densematrix calls are more than fast enough, the matrix assembly in sparselizard is entirely multithreaded and extremely efficient already: the actual time consuming part is moved to a matrix matrix product (one of the two matrices even entirely fits in the cache!) performed efficiently by blas