|
From: | Paul Kienzle |
Subject: | Re: Working patch for FFTW 3.0.x and Nd FFT's |
Date: | Thu, 19 Feb 2004 08:12:38 -0500 |
On Feb 18, 2004, at 11:30 PM, John W. Eaton wrote:
So the basic idea is what you suggested, to save a location and set up for the signal handler to jump back to this location, then restore any previous location that may have been saved, so if we are inside some nested calls we can keep jumping back up the stack of saved locations (to get this right, you also need to use the macros BEGIN_INTERRUPT_WITH_EXCEPTIONS and END_INTERRUPT_WITH_EXCEPTIONS also defined in quit.h. For examples of their usage, look at any of the functions in Octave that call user-supplied functions (in liboctave, LSODE.cc, DASSL.cc, etc.) So, should we also surround the FFTW code with these immediate interrupt enabling macros?
The question I have is whether this should happen implicitly around every binary function, or around every DEFUN_DLD, or if the user is required to put it in where it is needed. The only advantage of putting it only where needed is that it doesn't cost anything where it isn't needed. The advantage of doing it everywhere is that it simplifies the code everywhere. Making it implicit in DEFUN_DLD is probably a good compromise, at least for the user-defined extensions. I timed the following: for (int i=0; i < n; i++) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; op END_INTERRUPT_WITH_EXCEPTIONS; } Using total=total+1 as op (total an int) I got the following: octave:12> t=time; interrupt(100000000); time-t ans = 1.5228 octave:3> t=time; nointerrupt(100000000); time-t ans = 0.83887 Using total=total+sin(total): octave:3> t=time; interrupt(100000000); time-t ans = 17.290 octave:2> t=time; nointerrupt(100000000); time-t ans = 15.204 Using total=total+1. octave:5> t=time; interrupt(100000000); time-t ans = 2.1333 octave:6> t=time; nointerrupt(100000000); time-t ans = 2.0113 Using total=total+args(0).double_value() octave:3> t=time; interrupt(100000000); time-t ans = 13.244 octave:4> t=time; nointerrupt(100000000); time-t ans = 10.695 The results are a bit weird, but I believe they show the cost of the interrupt protection code is trivial compared to the cost of an oct-file function call. Paul Kienzle address@hidden
[Prev in Thread] | Current Thread | [Next in Thread] |