Cancellation/Termination of Solver

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Cancellation/Termination of Solver

randress
Occasionally I will want to stop solution processing after it has begun.  The "Cancel" button on the notification solver progress window does not seem to work for me in these situations.  I am using Windows 7.  

If this is normal, are there other methods that might work besides killing the MATLAB process? ... which is what I have been doing :-(    

If this is not normal, what might I be doing/configuring wrong?

Kind regards,
Randal
Reply | Threaded
Open this post in threaded view
|

Re: Cancellation/Termination of Solver

Precise Simulation
Administrator
This is normal and expected as the Matlab runtime is single threaded.
Reply | Threaded
Open this post in threaded view
|

Re: Cancellation/Termination of Solver

randress
Precise Simulation wrote
This is normal and expected as the Matlab runtime is single threaded.
I see.  And the solver is not executing in some cancel-able event ....

I know nothing about windows signals, but thinking in c/unix terms ... could the SIGTERM handler be replaced while the solver is running and use something like setjmp()/longjump() to save the state before calling the solver and to return to that state from the SIGTERM handler (signaled by "Cancel") after restoring the signal state?  

Sorry... I shouldn't be guessing how things are implemented ... just wondering...

I suppose as a work-around, I can save to a temp.fea file before each solve attempt so that if I had to kill the process I could return to where I was after restarting MATLAB/FEATool...

Perhaps FEATool could do that as well; if so, then I could post that as an enhancement request.

Anyway, thanks for the answer...

BTW, I have observed that a grid generation cancellation has worked for me.

Kind regards,
Randal
Reply | Threaded
Open this post in threaded view
|

Re: Cancellation/Termination of Solver

Precise Simulation
Administrator
This post was updated on .
Matlab typically waits for a function call to finish, thus callbacks and signals/system events are only processed after or/in between each step in Matlab .m source code files. Linear solvers are handled as function calls to external open source libraries (SuiteSparse/UMFPACK, MUMPS etc.) and can typically not be interrupted unless they themselves contain functionality for this outside of the Matlab execution thread (which they to my knowledge typically don't). The linear solvers themselves are in FEATool called from the "solvelin" function which is open to user/self modification:

https://github.com/precise-simulation/featool-multiphysics/blob/master/solvelin.m

As for grid generation and other calls using an external software, it is started/launched with the "system('binary.exe &')" call syntax and therefore run without waiting for the process to finish or a return code. The process is then monitored via output/log files in a primitive Matlab while loop until it is finished, and can therefore register system events and be interrupted (after each iteration in the while loop).
Reply | Threaded
Open this post in threaded view
|

Re: Cancellation/Termination of Solver

randress
Thank you for the further information and explanation.  

I wasn't thinking about the details of what FEATool must do.  You are restricted to interfaces and capabilities that MATLAB and the solvers provide.  

I think the "Save as model to temp.fea" workaround will do nicely. It will give me a place to recover to should I have to kill the process.  Probably should be doing that anyway.

Kind regards,
-Randal