Example #1
0
        def testFunction(self):
            res = pmi.reduce(add, mockFunc)
            if pmi.isController:
                self.assertEqual(res, 42 * pmi.size)
            else:
                self.assertEqual(res, None)

            # by string
            res = pmi.reduce("add", mockFunc)
            if pmi.isController:
                self.assertEqual(res, 42 * pmi.size)
            else:
                self.assertEqual(res, None)
Example #2
0
        def testLambda(self):
            pmi.exec_("myadd = lambda a,b: a+b")

            res = pmi.reduce("myadd", mockFunc)
            if pmi.isController:
                self.assertEqual(res, 42 * pmi.size)
            else:
                self.assertEqual(res, None)

            pmi.exec_("del myadd")
Example #3
0
 def __getattr__(self, key):
     value = pmi.reduce(pmi.MAX, self, 'getLocalData', key)
     return value
Example #4
0
 def node(self):
     value, node = pmi.reduce(pmi.MAXLOC, self, 'locateParticle')
     return node
Example #5
0
 def __getattr__(self, key):
     value = pmi.reduce(pmi.MAX, self, 'getLocalData', key)
     return value
Example #6
0
 def node(self):
     value, node = pmi.reduce(pmi.MAXLOC, self, 'locateParticle')
     return node
Example #7
0
 def testReduceOp(self):
     res = pmi.reduce(pmi.SUM, mockFunc)
     if pmi.isController:
         self.assertEqual(res, 42 * pmi.size)
     else:
         self.assertEqual(res, None)