kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
470 stars 76 forks source link

Using int32 to reduce memory usage in large problems #1118

Closed kinnala closed 1 month ago

kinnala commented 3 months ago

We have recently computed some test problems with close to 100 million degrees-of-freedom using scikit-fem (https://arxiv.org/abs/2404.06260), in fact, the largest case was only 85 million DOFs because we ran frequently into some out-of-memory issues on our laptops (we were using a laptop with 16 GB or 32 GB memory + cloud for MOR); these were quite often due to some index arrays in Mesh and Dofs and Basis becoming huge.

This got me thinking whether using int32 everywhere within the library would alleviate this issue. While we have pretty much used int64 everywhere, it doesn't seem to be necessary for the scale of problems that are targeted by this library. Here is a related discussion on MFEM which targets much larger problems and they are still using int32: https://github.com/mfem/mfem/issues/1515

So I am thinking about introducing a configuration variable which allows changing the type of the index arrays everywhere within the library, to test the differences and potentially switch from one type to another more easily.

Any comments welcome.