def setUp(self): try: self.comm = create_comm_of_size(self.get_comm_size()) except InvalidCommSizeError: msg = "Must run with comm size >= {}." raise unittest.SkipTest(msg.format(self.get_comm_size())) else: self.more_setUp()
def benchmark_function(f, *args, **kwargs): comm_size = MPI.COMM_WORLD.Get_size() sizes = [] times = [] size = 1 while size <= comm_size: try: comm = create_comm_of_size(size) except InvalidCommSizeError: pass else: try: t1 = MPI.Wtime() f(comm, *args, **kwargs) t2 = MPI.Wtime() times.append(t2-t1) sizes.append(size) except MPICommError: pass else: "It failed" size *= 2 return (sizes, times, [times[0]/t for t in times])
def test_size_too_big(self): """ Test that a comm of size with too many nodes will fail. """ too_many = 2 * self.max_size with self.assertRaises(InvalidCommSizeError): create_comm_of_size(too_many)
def setUpClass(cls): try: cls.comm = create_comm_of_size(cls.get_comm_size()) except InvalidCommSizeError: msg = "Must run with comm size >= {}." raise unittest.SkipTest(msg.format(cls.get_comm_size()))