def check_sanity(_map, nodes, verbose=False): if verbose: print(_map) print(("x: %s\n" % str(x))) print((type, _map.__name__)) _config = { 'type': "blocking", 'threads': False, 'nproc': nodes, 'ncpus': nodes } mapconfig = {'nodes': nodes} start = time.time() res = _map(squared, x, **mapconfig) end = time.time() - start if verbose: print(("time to results:", end)) print(("y: %s\n" % str(res))) assert res == x2 mapconfig.update(_config) res = _map(squared, x, **mapconfig) assert res == x2 mapconfig.update({'program': 'hostname', 'workdir': '.', 'file': ''}) res = _map(squared, x, **mapconfig) assert res == x2 from pyina.mappers import worker_pool mapconfig.update({'mapper': worker_pool, 'timelimit': '00:00:02'}) res = _map(squared, x, **mapconfig) assert res == x2
def check_sanity(_map, nodes, verbose=False): if verbose: print(_map) print(("x: %s\n" % str(x))) print((type, _map.__name__)) _config = {'type':"blocking", 'threads':False, 'nproc':nodes, 'ncpus':nodes} mapconfig = {'nodes':nodes} start = time.time() res = _map(squared, x, **mapconfig) end = time.time() - start if verbose: print(( "time to results:", end)) print(( "y: %s\n" % str(res))) assert res == x2 mapconfig.update(_config) res = _map(squared, x, **mapconfig) assert res == x2 mapconfig.update({'program':'hostname','workdir':'.','file':''}) res = _map(squared, x, **mapconfig) assert res == x2 from pyina.mappers import worker_pool mapconfig.update({'mapper':worker_pool,'timelimit':'00:00:02'}) res = _map(squared, x, **mapconfig) assert res == x2
def check_maps(_map, nodes, items=4, delay=0): _x = range(int(-items / 2), int(items / 2), 2) _y = range(len(_x)) _d = [delay] * len(_x) _z = [0] * len(_x) #print map res1 = list(map(busy_squared, _x)) mapconfig = {'nodes': nodes} #print _map _res1 = _map(busy_squared, _x, **mapconfig) assert _res1 == res1 res2 = list(map(busy_add, _x, _y, _d)) _res2 = _map(busy_add, _x, _y, _d, **mapconfig) assert _res2 == res2
def check_maps(_map, nodes, items=4, delay=0 ): _x = range(int(-items/2), int(items/2),2) _y = range(len(_x)) _d = [delay]*len(_x) _z = [0]*len(_x) #print map res1 = list(map(busy_squared, _x)) mapconfig = {'nodes':nodes} #print _map _res1 = _map(busy_squared, _x, **mapconfig) assert _res1 == res1 res2 = list(map(busy_add, _x, _y, _d)) _res2 = _map(busy_add, _x, _y, _d, **mapconfig) assert _res2 == res2
def test_maps(_map, nodes, items=4, delay=0 ): _x = range(-items/2,items/2,2) _y = range(len(_x)) _d = [delay]*len(_x) _z = [0]*len(_x) #print map res1 = map(busy_squared, _x) mapconfig = {'nodes':nodes} #print _map _res1 = _map(busy_squared, _x, **mapconfig) assert _res1 == res1 res2 = map(busy_add, _x, _y, _d) _res2 = _map(busy_add, _x, _y, _d, **mapconfig) assert _res2 == res2