示例#1
0
 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()
示例#2
0
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])
示例#3
0
 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)
示例#4
0
 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()))