GraphBLAS / LAGraph

This is a library plus a test harness for collecting algorithms that use the GraphBLAS. For test coverage reports, see https://graphblas.org/LAGraph/ . Documentation: https://lagraph.readthedocs.org
Other
228 stars 61 forks source link

LAGraph finalize doesn't reset bool LG_init_has_been_called #157

Closed mcordery closed 1 year ago

mcordery commented 1 year ago

A call to LAGr_init() sets the global boolean bool LG_init_has_been_called = true; However, a subsequent call to LAGraph_finalize() does not reset the parameter to false. This can cause problems in LAGr_init() which tests the value and returns with GrB_INVALID_VALUE if true. This can cause later errors if, as in MMRead, initialize/finalize are called in sequence several times. I would suggest putting in an

extern bool LG_init_has_been_called; LAGraph_finalize() { ... LG_init_has_been_called = false; ... }

DrTimothyAldenDavis commented 1 year ago

That's by design, because GrB_init and GrB_finalize can only be called once. Once GrB_finalize has been called the GraphBLAS C API says that no other GrB method can be called, not even another call to GrB_init.