if rank == 0: print "original array %s" % arr # prepare copper exchanger from exchanger_strategy import Exch_copper16 exch = Exch_copper16(comm, avg=False) exch.prepare(ctx, drv, [shared_x]) exch.exchange() if rank == 0: print "copper16 summation: %s" % shared_x.get_value() # prepare ar exchanger from exchanger_strategy import Exch_allreduce exch = Exch_allreduce(comm, avg=False) exch.prepare([shared_xx]) exch.exchange() if rank == 0: print "ar summation: %s" % shared_xx.get_value() clean_device(ctx=ctx)
# device='gpu'+str(rank) from test_exchanger import init_device, clean_device drv, ctx, arr, shared_x, shared_xx = init_device(device=device) if rank == 0: print 'original array %s' % arr # prepare copper exchanger from exchanger_strategy import Exch_copper exch = Exch_copper(comm, avg=False) exch.prepare(ctx, drv, [shared_x]) exch.exchange() if rank == 0: print 'copper summation: %s' % shared_x.get_value() # prepare ar exchanger from exchanger_strategy import Exch_allreduce exch = Exch_allreduce(comm, avg=False) exch.prepare([shared_xx]) exch.exchange() if rank == 0: print 'ar summation: %s' % shared_xx.get_value() clean_device(ctx=ctx)