3

This may be off-topic, but when accidentally running a process which turns out to be computationally more intensive than expected (or even getting stuck in an infinite loop), it seems that there is often no way to reliably abort. Sometimes it is possible to kill the specific Mathematica kernel from the terminal, but often the entire system crashes. (NB: I am using v13 on Ubuntu Linux 22.04).

So, if I am running "risky" or experimental code and doesn't care about the performance impact, is there a way to force Mathematica to regularly pause evaluation and or listen for Abort interruptions? I'm aware I can set TimeConstrained or MemoryConstrained for specific functions, and setting $RecursionLimit and $IterationLimit can also help in a narrow range of scenarios, but the ideal would be a global notebook option that allows aborting any process, ideally without having to restart the kernel. Is this possible with Mathematica notebooks?

user366202
  • 451
  • 2
  • 8
  • 1
    Related: https://mathematica.stackexchange.com/questions/120720/ (especially the answer by @Carib John)- as discussed there, the kernel should in principle regularly check for interrupts. For me, the most common reason why this doesn't work is if the front-end is also overwhelmed, e.g. by excessive print/echo statements (this is also the most frequent cause for crashes of the entire Mathematica instance). The second most common reason is probably that the kernel is stuck inside a function that doesn't check for interrupts, which might be something to report to WRI. – Lukas Lang Apr 06 '23 at 15:12

0 Answers0