(j3.2006) ieee_set_halting_mode
Bill Long
longb
Thu Sep 23 23:37:32 EDT 2010
John Reid wrote:
> Bill Long wrote:
>>> I "sense" that this question arises because different people have
>>> different ideas of what PURE means. It means different things in
>>> different C.S.-like contexts, in particular Fortran PURE procedures
>>> are not "pure functions" in at least one of the traditional CS senses
>>> as they are permitted to read global state.
>>
>> That's fine. But ieee_set_halting_mode performs a WRITE of global state.
>
> I don't see where the standard says this.
>
The standard does not say how to implement the function. I'm just
pointing out what actually happens in the real world to implement the
function.
> With 10**6 images, would you really work with a single register?
Each image has its own ieee status. The "global" state is only relative
to the local image - global in the same sense that a variable in a
common block or module is global. Which is also the meaning of 'global'
in the Note in the standard.
>
> See 14.6 for the rule on halting mode: "In a procedure other than
> IEEE_SET_HALTING_MODE or IEEE_SET_STATUS, the processor shall not change
> the halting mode on entry, and on return shall ensure that the halting mode is
> the same as it was on entry." It is purposely vague on when halting actually
> occurs: "Halting is not precise and may occur any time after the exception has
> occurred."
>
Thanks. This is the critical quote that answers my original question.
This requires that you have to make a second write to a global state
before returning from the procedure where the call was made. So a
call at the beginning of the main program is fine - it lasts through the
program. Calls inside a subprogram would require a read and two writes
of the trap mask for a conforming implementation. The performance hit
for that is quite large. So I would not expect to see this used in a
subprogram, which does match what I've seen so far.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list