Hello,
I was wondering which is the best option in your opinion between Numpy (or Scipy) and PETSc for construction of a reduced order model. Namely, which one gives the best tradeoff between implementation ease and performance when it comes to vectorizing matrices, computing affine decomposition coming from empirical interpolation methods and computing SVDs for proper orthogonal decompositions between the two packages.
If PETSc turns out to be the clear best choice, where can I find reference for the operations aforementioned?
Thanks a lot in advance,
Federico
Hi Federico,
I’ve been using a mix of Numpy/Scipy and PETSc (+ SLEPc) for model reduction with FEniCS/FEniCSx. In the end picking one over the other reduces to making a trade-off between “program time” (i.e. speed and performance) and “programmer time” (i.e. your time).
Personally I’m finding that Python is easier to work with for most operations that aren’t specifically “defining and constructing a vector/matrix” or “solving a (non)linear system”. However, Python can be significantly slower than using PETSc, partially because of all the required conversions of PETSc matrices to Numpy arrays (or Scipy sparse arrays) and partially because Python is just relatively slow compared to C++. I’ve been using Python to quickly try out certain model reduction methods (including POD and discrete empirical interpolation in legacy FEniCS, in this paper). Once I’ve verified that the accuracy of a method is sufficient I start looking into converting the code into PETSc, so I can ascertain its computational performance as well (since comparing the performance of Python code to native FEniCS/C++ is always going to go poorly).
If PETSc turns out to be the clear best choice, where can I find reference for the operations aforementioned?
SLEPc is an extension of PETSc that includes routines for things like computing Singular Value Decompositions. RBniCS is a reduced basis model reduction package that is built on top of (legacy) FEniCS. If I’m not mistaken RBniCSx (a similar package for FEniCSx) is still under development, but you might be able to get some useful info from the code nonetheless.