From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Thu May 16 22:09:31 2013
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id BEF0A356E40; Thu, 16 May 2013 22:09:31 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from exprod6og123.obsmtp.com (exprod6og123.obsmtp.com [64.18.1.241])
	by www.open-std.org (Postfix) with ESMTP id 40FBE35694E
	for <sc22wg5@open-std.org>; Thu, 16 May 2013 22:09:14 +0200 (CEST)
Received: from CFWEX01.americas.cray.com ([136.162.34.11]) (using TLSv1) by exprod6ob123.postini.com ([64.18.5.12]) with SMTP
	ID DSNKUZU84Z+NJ4vUj/4QhyVvfBhqzc+he1m5@postini.com; Thu, 16 May 2013 13:09:30 PDT
Received: from fortran.us.cray.com (172.31.19.200) by
 CFWEX01.americas.cray.com (172.30.88.25) with Microsoft SMTP Server id
 14.2.342.3; Thu, 16 May 2013 15:09:05 -0500
Message-ID: <51953DAA.6020203@cray.com>
Date: Thu, 16 May 2013 15:12:26 -0500
From: Bill Long <longb@cray.com>
Reply-To: <longb@cray.com>
Organization: Cray Inc.
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: "N.M. Maclaren" <nmm1@cam.ac.uk>
CC: <sc22wg5@open-std.org>, Mark Batty <mbatty@cantab.net>, "Lionel, Steve"
	<steve.lionel@intel.com>, Lorri Menard <lorri.menard@intel.com>, Daniel C
 Chen <cdchen@ca.ibm.com>
Subject: Re: Existing support for uses of atomics in Fortran coarray codes
References: <Prayer.1.3.5.1305141957470.21184@hermes-2.csi.cam.ac.uk> <51929A9A.1090901@cray.com> <Prayer.1.3.5.1305151517070.6164@hermes-2.csi.cam.ac.uk>
In-Reply-To: <Prayer.1.3.5.1305151517070.6164@hermes-2.csi.cam.ac.uk>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk



On 5/15/13 9:17 AM, N.M. Maclaren wrote:
> Thank you very much.  We have a lot of latitude in what we can specify,
> but we do need to ensure that both programmers and implementors know
> what is actually required.  And we may as well be guided by existing
> implementations.

One other area of implementation might be relevant.  We currently have 
ATOMIC_DEFINE and ATOMIC_REF intrinsics.  How those are implemented can 
interact with the new atomics.   For the Cray implementation, we use the 
following:


ATOMIC_REF  --> atomic_fetch_and_add (target, 0)

An equally viable alternative would be atomic_fetch_and_or (target, 0).


ATOMIC_DEFINE --> atomic_and_xor (target, 0, newval)

I had proposed the and_xor form as an additional user-level intrinsic. 
But it did not get the votes needed. However, for things like this it is 
very valuable.  And, of course, the implementation can still use it 
internally without it being available to users.


By using atomic operations to implement these intrinsics, we ensure that 
they are operating in the same way as other atomics, and can be lumped 
together in the same memory model description.

Cheers,
Bill

>
> Regards,
> Nick Maclaren.
>
>
>
>
>

-- 
Bill Long                                           longb@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


