nrn
nrn copied to clipboard
h.nrn_feenableexcept(1) for macOS
Very nice. I'm still faintly curious why (where) errno was occasionally set before the first call to one of the math functions on the mac. And it will eventually be useful to get h.nrn_feenableexcept(1)
working on the mac. But that is for a future PR.
Originally posted by @nrnhines in https://github.com/neuronsimulator/nrn/pull/1926#pullrequestreview-1052312290
The comment at https://github.com/neuronsimulator/nrn/issues/1887#issuecomment-1173200639 is related to this issue.
I've learned (observed) a few things from the hines/fexc branch but there are still a few puzzles. For Mac x86_64 and launching python, I've been unable to replace the SIGFPE handler, and so a floating exception exits with a stack trace.
Not so bad, really, as the whole point of h.nrn_fpeenableexcept(1)
is to discover where a floating exception occurs.
For Mac M1 arm64 and launching python, SIGILL is raised for floating exceptions and my fpecatch handler does a reasonable job of printing the backtrace and returning to python (see the nrn/test/pynrn/test_math.py) if the floating exception occurs in NEURON. But if it occurs in python, python will exit (crash) after the fpecatch calls hoc_execerror which does a longjump to who knows where. Furthermore, I know of no way to determine which type of floating exception raised the SIGILL (no distinguishing between FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW
)