ralna / spral

Sparse Parallel Robust Algorithms Library
https://ralna.github.io/spral/
Other
104 stars 27 forks source link

Fix returned stats being uninitialised on aborted factorization if OpenMP disabled #121

Closed mjacobse closed 1 year ago

mjacobse commented 1 year ago

If configured with --disable-openmp, running ssids_test with valgrind reveals dependency on uninitialised values. The issue is that the early returns in NumericSubtree, e.g. https://github.com/ralna/spral/blob/c50996a366c5e8d113633ddbf7a37a4bfc301a66/src/ssids/cpu/NumericSubtree.hxx#L115-L122 return stats before they have been initialized here: https://github.com/ralna/spral/blob/c50996a366c5e8d113633ddbf7a37a4bfc301a66/src/ssids/cpu/NumericSubtree.hxx#L237-L241 These were introduced in 2288ac81 as alternative to the omp cancel for when compiling without OpenMP.

This moves up the initialisation of stats such that they can be returned safely from within the loops.