Hello,
I have been wrestling with a C++ program written by others... I've managed to pinpoint the issue to one method that doesn't seem to exhibit a deterministic behaviour.
The method simply computes a linear system (796 rows, 8 columns) using calls to lapack (dgels). To verify if the input is the same, I exported the incoming matrices to binary files. For each run of the program, these files are identical.
The inconsistence occurs after the second call to lapack, so to verify this, I copied the code to a simple standalone program, where I perform the exact same calculations (I just read in the binary files to get the data, active code is copy/paste). And this stand alone program is .... deterministic!
So I went back to the original program, read in the same files, and again it is not deterministic.
The only difference is that the original program is multithreaded: one thread for the gui, one for the computations. Lapack isn't thread-safe, but there are mutex locks around all the lapack calls, and at this point in the program there are no two concurrent threads using lapack.
I have no clue where to start searching for this... Any thoughts on what could cause this erratic behaviour?
Jörg
I have been wrestling with a C++ program written by others... I've managed to pinpoint the issue to one method that doesn't seem to exhibit a deterministic behaviour.
The method simply computes a linear system (796 rows, 8 columns) using calls to lapack (dgels). To verify if the input is the same, I exported the incoming matrices to binary files. For each run of the program, these files are identical.
The inconsistence occurs after the second call to lapack, so to verify this, I copied the code to a simple standalone program, where I perform the exact same calculations (I just read in the binary files to get the data, active code is copy/paste). And this stand alone program is .... deterministic!
So I went back to the original program, read in the same files, and again it is not deterministic.
The only difference is that the original program is multithreaded: one thread for the gui, one for the computations. Lapack isn't thread-safe, but there are mutex locks around all the lapack calls, and at this point in the program there are no two concurrent threads using lapack.
I have no clue where to start searching for this... Any thoughts on what could cause this erratic behaviour?
Jörg
Comment