dekoning-lab / WFES2-GUI

GUI implementation of wfes2.
GNU General Public License v3.0
0 stars 1 forks source link

Stop button #22

Closed AlbertoCasasOrtiz closed 2 years ago

AlbertoCasasOrtiz commented 4 years ago

Stop button takes too much time to stop an execution. Looks like we can stop the execution of custom code (e.g. Matrix generation, write matrix to file, generate image...) but not when a third party library is being executed (e.g. Solving matrix with either Intel MKL Pardiso or ViennaCL).

jasondk commented 3 years ago

@AlbertoCasasOrtiz I've been reading about this because especially in time-dist and phase-type, I often want to stop a computation (since these can go on virtually forever if the integration limits / number of generations are large).

Although I understand that killing a QThread is hard in general when making calls to third party libraries, both of these sub-programs are essentially just iteratively making sparse matrix-vector multiplications. Is it feasible to insert a signal handler of some kind in the main loop for phase-type and time-dist that would allow interruption?

AlbertoCasasOrtiz commented 3 years ago

Yes, I think that's the proper way of doing it. In phase-type and time-dist it would be easy to insert a boolean for stopping the main loop that makes the calculations, and activating that boolean when the stop button is clicked.

I was thinking in doing that for those executables, and for the generation of matrices, images, files... The problem comes with calls to external libraries like Intel MKL, where you cannot set the boolean

AlbertoCasasOrtiz commented 3 years ago

I open this again because it is not working for matrix generation yet. If I stop the computation of the matrix when it has not finished yet, when Intel MKL try to free memory, it is trying to free data that has not been instantiated (the remaining matrix not computed yet). This generates a SegFault error sometimes.

I move this issue to Post-Release project.