Esempio n. 1
0
 def done_python_custom(self, result):
     assert result == [10, ro.lastIdx[0],
                       0], "Custom Python myReduce failed"
     print("[Main] All Python custom reductions done. Test passed")
     self.recvdReductions += 1
     if (self.recvdReductions >= self.expectedReductions):
         CkExit()
Esempio n. 2
0
 def done_gather_array(self, result):
     gather_arr_indices = [tuple([i]) for i in range(self.nElements)]
     gather_grp_indices = [[i, 42] for i in range(CkNumPes())]
     assert result == gather_arr_indices or result == gather_grp_indices, "Gather arrays failed."
     print("[Main] Gather collective for arrays done. Test passed")
     self.recvdReductions += 1
     if (self.recvdReductions >= self.expectedReductions):
         CkExit()
Esempio n. 3
0
 def done_gather_single(self, result):
     gather_arr_indices = list(range(self.nElements))
     gather_grp_indices = list(range(CkNumPes()))
     assert result == gather_arr_indices or result == gather_grp_indices, "Gather single elements failed."
     print("[Main] Gather collective for single elements done. Test passed")
     self.recvdReductions += 1
     if (self.recvdReductions >= self.expectedReductions):
         CkExit()
Esempio n. 4
0
 def done_python_builtin(self, result):
     sum_indices = (self.nElements * (self.nElements - 1)) / 2
     assert type(result) == MyObject
     assert result.value == sum_indices or result.value == 0, "Built-in Python _sum or _product reduction failed"
     print("[Main] All Python builtin reductions done. Test passed")
     self.recvdReductions += 1
     if (self.recvdReductions >= self.expectedReductions):
         CkExit()
Esempio n. 5
0
 def done_charm_builtin(self, result):
     sum_indices = (self.nElements * (self.nElements - 1)) / 2
     assert list(result) == [10, sum_indices
                             ], "Built-in Charm sum_int reduction failed"
     print("[Main] All Charm builtin reductions done. Test passed")
     self.recvdReductions += 1
     if (self.recvdReductions >= self.expectedReductions):
         CkExit()
Esempio n. 6
0
 def done_float(self, reduction_result):
   expected_result = [x*CkNumPes() for x in [10.1, 13.4]]
   indices_sum = (CkNumPes() * (CkNumPes() - 1))/2
   expected_result += [float(indices_sum)]
   assert_allclose(reduction_result, expected_result, 1e-03)
   print("[Main] All sum_float contributions done. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
       CkExit()
Esempio n. 7
0
 def done_group_to_group_bcast(self):
   print("[Main] All group-to-group bcast contributions done. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
     CkExit()
Esempio n. 8
0
 def done_nop(self):
   print("[Main] All nop contributions received. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
       CkExit()
Esempio n. 9
0
 def done_int(self, reduction_result):
   assert reduction_result == 42*CkNumPes(), "Group-to-singleton sum_int reduction failed"
   print("[Main] All sum_int contributions done. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
       CkExit()
Esempio n. 10
0
 def done_array_to_group(self):
   print("[Main] All array-to-group contributions done. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
     CkExit()
Esempio n. 11
0
 def done_float(self, reduction_result):
   assert_allclose(reduction_result, [101.0, 134.0, 45.0], 1e-03)
   print("[Main] All sum_float contributions done. Test passed")
   self.recvdReductions += 1
   if (self.recvdReductions >= self.expectedReductions):
       CkExit()
Esempio n. 12
0
 def done(self):
     print("Program done in", time.time() - self.startTime)
     charm.printStats()
     CkExit()