You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_demo demo, and debug with matrix Matrix/bcsstk01.tri, noting that at line 388 of cholmod_l_demo.c the solver is called repeatedly with the same inputs.
Within the solver, at line 1635 of cholmod_solve.c, the handle Y_Handle is passed to ensure_dense to check that it is suitable for the current solve. On the first run, this will be allocated appropriately, note that, e.g., the leading dimension Y_Handle->d is set equal to 4.
The workspace matrix Y is then used in a call to ptrans on line 1649, upon return the leading dimension Y_Handle->d is now set to 1.
On the next call to the solver, ensure_dense will reallocate Y because 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):
I suppose it would suffice to save the dimensionality of Y at line 1641 of cholmod_solve.c, and restore at 1677, if this is all that is required I can open a PR to that effect. Alternatively ensure_dense could do more work to see if the total size of the input matrix is suitable and reassign its dimensionality accordingly.
Describe the bug
Repeatedly calling
cholmod_l_solve2
with the same inputs reallocates workspace matrixY
on each call for simplical factorisations under certain conditions, this causes excessive calls tomalloc
/free
when solving a large number of systems.To Reproduce
Compile the
cholmod_l_demo
demo, and debug with matrixMatrix/bcsstk01.tri
, noting that at line 388 ofcholmod_l_demo.c
the solver is called repeatedly with the same inputs.Within the solver, at line 1635 of
cholmod_solve.c
, the handleY_Handle
is passed toensure_dense
to 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->d
is set equal to 4.The workspace matrix
Y
is then used in a call toptrans
on line 1649, upon return the leading dimensionY_Handle->d
is now set to 1.On the next call to the solver,
ensure_dense
will reallocateY
because 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):
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.
The text was updated successfully, but these errors were encountered: