(j3.2006) (SC22WG5.4480) Added atomic

Bill Long longb
Fri Jun 17 12:07:08 EDT 2011


The list of comments on the coarray TR from Rice suggested adding a SWAP 
atomic subroutine.    The list in 11-200 includes all of the "common" 
atomic operations except one: atomic andxor. I'm inclined to add that 
one, which would make SWAP unnecessary. Or we could add both.  For those 
who are not big amo users...

subroutine atomic_andxor (atom, andmask, xormask)

atom - variable atomically updated according to

    atom = ieor ( iand (atom, andmask), xormask))

subroutine atomic_fandxor (atom, andmask, xormask, old)

similar to atomic_fandxor except old is set to the old value of atom.

If andmask is all 0 bits, and xormask is the new value, then the effect 
is to set atom to the new value and old to the old one.  Can be used to 
do a swap.

The real virtue of this operation is that it allows you to atomically 
define a subset of the bits in the atom variable.

If this is added, is there a need for a separate atomic_swap?

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