def __init__(self, args): self.expectedReductions = 7 self.recvdReductions = 0 nDims = 1 ARRAY_SIZE = [10] * nDims # 1-D array with 10 elements nElements = 1 for x in ARRAY_SIZE: nElements *= x print('Running reduction example on ' + str(charm.numPes()) + ' processors for ' + str(nElements) + ' elements, array dims=' + str(ARRAY_SIZE)) arrProxy = Array(Test, ARRAY_SIZE) groupProxy = Group(TestGroup) charm.thisProxy.updateGlobals({'mainProxy': self.thisProxy, 'arrProxy': arrProxy, 'groupProxy': groupProxy}, '__main__', awaitable=True).get() arrProxy.doReduction()
def __init__(self, args): self.recvdReductions = 0 self.expectedReductions = 4 nDims = 1 ARRAY_SIZE = [10] * nDims lastIdx = tuple([x-1 for x in ARRAY_SIZE]) self.nElements = 1 for x in ARRAY_SIZE: self.nElements *= x print('Running reduction example on ' + str(charm.numPes()) + ' processors for ' + str(self.nElements) + ' elements, array dims=' + str(ARRAY_SIZE)) arrProxy = Array(Test, ARRAY_SIZE) charm.thisProxy.updateGlobals({'mainProxy': self.thisProxy, 'arrProxy': arrProxy, 'lastIdx': lastIdx}, '__main__', awaitable=True).get() arrProxy.doReduction()