In case anybody cares: In GASNet we have atomics for "add", "sub", "incr", "decr", and "dec-and-test".
On some platforms all five are implemented in terms of a single inline-atomic for "add". There are platforms on which one or more of "incr", "decr" and "decr-and-test" have custom implementations. However, we have found not even one platform where it is necessary (or even useful) to implement "sub" by any other means than a macro that calls "add". FWIW: we use "sub" in only a handfull of places (more than 1 but less than 10) -Paul On Thu, Mar 26, 2015 at 8:22 AM, Nathan Hjelm <hje...@lanl.gov> wrote: > > I am working on cleaning up the atomics in opal and I noticed something > odd. We define opal_atomic_sub_32 and opal_atomic_sub_64 yet only use > opal_atomic_sub_32 once: > > ./opal/runtime/opal_progress.c: val = > opal_atomic_sub_32(&num_event_users, 1); > > This could easily be changed to: > > val = opal_atomic_add_32(&num_event_users, -1); > > And then we could remove all both opal_atomic_sub_32 and > opal_atomic_sub_64. Is there a reason to leave these functions in opal? > > > -Nathan > > _______________________________________________ > devel mailing list > de...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel > Link to this post: > http://www.open-mpi.org/community/lists/devel/2015/03/17160.php > -- Paul H. Hargrove phhargr...@lbl.gov Computer Languages & Systems Software (CLaSS) Group Computer Science Department Tel: +1-510-495-2352 Lawrence Berkeley National Laboratory Fax: +1-510-486-6900