def test_create_Context_with_targets_ranks(self): """Check that the target <=> rank mapping is consistent.""" check_targets(required=4, available=len(self.client)) targets = [3, 2] dac = Context(self.client, targets=targets) self.assertEqual(set(dac.targets), set(targets)) dac.close()
def test_create_Context_with_targets_ranks(self): """Check that the target <=> rank mapping is consistent.""" from distarray.globalapi.context import MPIContext check_targets(required=4, available=MPIContext.INTERCOMM.remote_size) targets = [3, 2] dac = Context(targets=targets) self.assertEqual(set(dac.targets), set(targets))
def test_different_contexts(self): check_targets(required=4, available=len(self.context.targets)) ctx1 = Context(targets=range(4)) ctx2 = Context(targets=range(3)) distribution1 = Distribution.from_shape(ctx1, (10,)) distribution2 = Distribution.from_shape(ctx2, (10,)) da1 = ctx1.ones(distribution1) da2 = ctx2.ones(distribution2) db1 = self.local_sin(da1) db2 = self.local_sin(da2) ndarr1 = db1.toarray() ndarr2 = db2.toarray() assert_array_equal(ndarr1, ndarr2)
def test_create_Context_with_targets(self): """Can we create a context with a subset of engines?""" check_targets(required=2, available=len(self.client)) dac = Context(self.client, targets=[0, 1]) self.assertIs(dac.client, self.client) dac.close()
def test_create_Context_with_targets(self): """Can we create a context with a subset of engines?""" from distarray.globalapi.context import MPIContext check_targets(required=2, available=MPIContext.INTERCOMM.remote_size) Context(targets=[0, 1])