-
Notifications
You must be signed in to change notification settings - Fork 291
Description
Describe the bug
Repeatedly calling cholmod_l_solve2 with the same inputs reallocates workspace matrix Y on each call for simplical factorisations under certain conditions, this causes excessive calls to malloc/free when solving a large number of systems.
To Reproduce
-
Compile the
cholmod_l_demodemo, and debug with matrixMatrix/bcsstk01.tri, noting that at line 388 ofcholmod_l_demo.cthe solver is called repeatedly with the same inputs. -
Within the solver, at line 1635 of
cholmod_solve.c, the handleY_Handleis passed toensure_denseto check that it is suitable for the current solve. On the first run, this will be allocated appropriately, note that, e.g., the leading dimensionY_Handle->dis set equal to 4. -
The workspace matrix
Yis then used in a call toptranson line 1649, upon return the leading dimensionY_Handle->dis now set to 1. -
On the next call to the solver,
ensure_densewill reallocateYbecause a check that the leading dimension is equal to 4 will fail.
Expected behavior
I did not expect the workspace Y to be reallocated.
Desktop (please complete the following information):
- OS: MacOS 10.15.4, Windows 10 2004
- compiler: Clang (MacOS), MinGW cross compile (Windows)
- BLAS and LAPACK library: OpenBLAS
- Version: master and previous
Additional context
This behaviour was identified when tracking excessive allocation in a Julia program (which uses CHOLMOD for its sparse factorisation routines), https://discourse.julialang.org/t/in-place-cholesky-solve-with-zero-allocation-simplical-vs-supernodal/41115/6.