Skip to content

Proper handling of Pardiso errors

The PardisoImpl class serves as a wrapper to the Intel OneAPI MKL library for solving sparse linear systems. This class provides three methods analyzePattern, factorize and compute that serves as a preprocess for preparing the matrix before solving the system. There is a dependency between factorize and analyzePattern, so analyzePattern must be executed before factorize. And also, in order to be able to execute the solve method, either compute or factorize has had to be executed. This dependency is modeled with the flags m_analysisIsOk and m_factorizationIsOk and checked at the beginning of the methods with an assert.

The problem is that when pardiso returns an error, only the attribute m_info is overwritten and nothing changes in m_analysisIsOk nor m_factorizationIsOk. So if the analyzePattern and the factorize methods are consequently executed without checking m_info it results in a undefined behaviour from pardiso.

There are two main possible solutions. Either in the method manageErrorCode an assert is included or when the attributes m_analysisIsOk and m_factorizationIsOk are assigned, it should force that m_info == Eigen::Success.

The affected file is PardisoSupport.h. Afftected lines of compute method: 276-277. Afftected line of analyzePattern method: 298. Afftected line of factorize method: 318. Lines of manageErrorCode: 234-248.

Edited by Antonio Sánchez