##// END OF EJS Templates
Fix parallel.client.View map() on numpy arrays
Samuel Ainsworth -
Show More
@@ -232,7 +232,8 b' class ParallelFunction(RemoteFunction):'
232 for seq in sequences:
232 for seq in sequences:
233 part = self.mapObject.getPartition(seq, index, nparts, maxlen)
233 part = self.mapObject.getPartition(seq, index, nparts, maxlen)
234 args.append(part)
234 args.append(part)
235 if not any(args):
235
236 if sum([len(arg) for arg in args]) == 0:
236 continue
237 continue
237
238
238 if self._mapping:
239 if self._mapping:
@@ -344,6 +344,18 b' class TestView(ClusterTestCase, ParametricTestCase):'
344 it = iter(arr)
344 it = iter(arr)
345 r = view.map_sync(lambda x:x, arr)
345 r = view.map_sync(lambda x:x, arr)
346 self.assertEqual(r, list(arr))
346 self.assertEqual(r, list(arr))
347
348 @skip_without('numpy')
349 def test_map_numpy(self):
350 """test map on numpy arrays (direct)"""
351 import numpy
352 from numpy.testing.utils import assert_array_equal
353
354 view = self.client[:]
355 # 101 is prime, so it won't be evenly distributed
356 arr = numpy.arange(101)
357 r = view.map_sync(lambda x: x, arr)
358 assert_array_equal(r, arr)
347
359
348 def test_scatter_gather_nonblocking(self):
360 def test_scatter_gather_nonblocking(self):
349 data = range(16)
361 data = range(16)
General Comments 0
You need to be logged in to leave comments. Login now