Exemple #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)
Exemple #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")
Exemple #3
0
 def __getattr__(self, key):
     value = pmi.reduce(pmi.MAX, self, 'getLocalData', key)
     return value
Exemple #4
0
 def node(self):
     value, node = pmi.reduce(pmi.MAXLOC, self, 'locateParticle')
     return node
Exemple #5
0
 def __getattr__(self, key):
     value = pmi.reduce(pmi.MAX, self, 'getLocalData', key)
     return value
Exemple #6
0
 def node(self):
     value, node = pmi.reduce(pmi.MAXLOC, self, 'locateParticle')
     return node
Exemple #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)