Esempio n. 1
0
 def test_invalid_ranks(self):
     """ Test that a comm from list with invalid ranks will fail. """
     max_size = self.max_size
     # Nodes should be 0..max_size - 1, so create invalid values.
     nodes = range(10, max_size + 10)
     with self.assertRaises(InvalidRankError):
         create_comm_with_list(nodes)
Esempio n. 2
0
 def test_invalid_ranks(self):
     """ Test that a comm from list with invalid ranks will fail. """
     max_size = self.max_size
     # Nodes should be 0..max_size - 1, so create invalid values.
     nodes = range(10, max_size + 10)
     with self.assertRaises(InvalidRankError):
         create_comm_with_list(nodes)
Esempio n. 3
0
 def test_create_comm_with_list(self):
     """ Test that create_comm_with_list() works correctly. """
     nodes = list(range(self.max_size))
     comm = create_comm_with_list(nodes)
     if comm == MPI.COMM_NULL:
         # Only proceed when not COMM_NULL.
         return
     # Run a simple test to confirm this comm works.
     size = len(nodes)
     nrows = size * 3
     d = Distribution.from_shape(comm=comm, shape=(nrows, 20))
     a = zeros(d)
     expected = numpy.zeros((nrows // size, 20))
     assert_array_equal(a.ndarray, expected)
     # Cleanup.
     comm.Free()
Esempio n. 4
0
 def test_create_comm_with_list(self):
     """ Test that create_comm_with_list() works correctly. """
     nodes = list(range(self.max_size))
     comm = create_comm_with_list(nodes)
     if comm == MPI.COMM_NULL:
         # Only proceed when not COMM_NULL.
         return
     # Run a simple test to confirm this comm works.
     size = len(nodes)
     nrows = size * 3
     d = Distribution.from_shape(comm=comm, shape=(nrows, 20))
     a = zeros(d)
     expected = numpy.zeros((nrows // size, 20))
     assert_array_equal(a.ndarray, expected)
     # Cleanup.
     comm.Free()
Esempio n. 5
0
 def _make_new_comm(rank_list):
     import distarray.localapi.mpiutils as mpiutils
     new_comm = mpiutils.create_comm_with_list(rank_list)
     if not mpiutils.get_base_comm():
         mpiutils.set_base_comm(new_comm)
     return proxyize(new_comm)  # noqa
Esempio n. 6
0
 def _make_new_comm(rank_list, base_comm):
     import distarray.localapi.mpiutils as mpiutils
     res = mpiutils.create_comm_with_list(rank_list, base_comm)
     return proxyize(res)  # noqa
Esempio n. 7
0
 def test_list_too_big(self):
     """ Test that a comm from list with too many nodes will fail. """
     too_many = 2 * self.max_size
     nodes = range(too_many)
     with self.assertRaises(InvalidCommSizeError):
         create_comm_with_list(nodes)
Esempio n. 8
0
 def _make_new_comm(rank_list):
     import distarray.localapi.mpiutils as mpiutils
     new_comm = mpiutils.create_comm_with_list(rank_list)
     if not mpiutils.get_base_comm():
         mpiutils.set_base_comm(new_comm)
     return proxyize(new_comm)  # noqa
Esempio n. 9
0
 def _make_new_comm(rank_list, base_comm):
     import distarray.localapi.mpiutils as mpiutils
     res = mpiutils.create_comm_with_list(rank_list, base_comm)
     return proxyize(res)  # noqa
Esempio n. 10
0
 def test_list_too_big(self):
     """ Test that a comm from list with too many nodes will fail. """
     too_many = 2 * self.max_size
     nodes = range(too_many)
     with self.assertRaises(InvalidCommSizeError):
         create_comm_with_list(nodes)