def barrier(self, bid=0, flags=gasnet.BARRIERFLAG_ANONYMOUS): """ Block until all threads have executed the barrier. This is a collective operation. :param bid: the barrier id number :type bid: int """ assert self._team_id == gasnet.team_all(), \ "Barriers only supported for TEAM_WORLD at the moment." gasnet.barrier_notify(bid, flags) gasnet.barrier_wait(bid, flags)
""" The rank of MYTHREAD within this team. """ return gasnet.node2rank(self._team_id, MYTHREAD) def ranks(self): """ The number of threads in this team. """ return gasnet.team_size(self._team_id) def thread_to_rank(self, thread): """ Translate a global thread id into a rank from this team. """ return gasnet.node2rank(TEAM_WORLD._team_id, thread) def rank_to_thread(self, rank): """ Translate a rank from this team into a global thread id. """ return gasnet.rank2node(TEAM_WORLD._team_id, rank) TEAM_WORLD = Team(gasnet.team_all()) class Proxy(object): """ This is the fundamental PyGAS object. It wraps an existing object and mimics its behavior, even when the original object is on a remote thread. UPC programmers can think of Proxies as shared pointers because they store a ``(thread_id, local_addr)`` tuple internally. """ def __init__(self, obj): """ Initialize a :class:`Proxy` to the given object.