def test_parallel_multires(self, parallel): x = combo_runner(foo3_float_bool, _test_combos1, num_workers=2, split=True, parallel=parallel) assert_allclose(x[0], _test_expect1) assert np.all(np.asarray(x[1])[1, ...])
def test_multires(self): combos = _test_combos1 x, y = combo_runner(foo3_float_bool, combos, split=True) xn = _test_expect1 yn = (np.array([1, 2]).reshape((2, 1, 1)) % np.array([2] * 24).reshape( (2, 3, 4))) == 0 assert_allclose(x, xn) assert_allclose(y, yn)
def test_multires(self): combos = _test_combos1 x, y = combo_runner(foo3_float_bool, combos, split=True) xn = _test_expect1 yn = (np.array([1, 2]).reshape((2, 1, 1)) % np.array([2] * 24).reshape((2, 3, 4))) == 0 assert_allclose(x, xn) assert_allclose(y, yn)
def test_parallel_dict(self, parallel): combos = OrderedDict(_test_combos1) x = [ *combo_runner(foo3_scalar, combos, num_workers=2, parallel=parallel, verbosity=2) ] assert_allclose(x, _test_expect1)
def test_executor_basic(self, executor, fn): import concurrent.futures as cf import multiprocessing as mp executor = { 'cf-process': cf.ProcessPoolExecutor, 'cf-thread': cf.ThreadPoolExecutor, 'mp-process': mp.Pool, 'mp-thread': mp.pool.ThreadPool, }[executor](2) x = combo_runner(fn, _test_combos1, executor=executor) assert_allclose(x, _test_expect1)
def test_simple(self): x = combo_runner(foo3_scalar, _test_combos1) assert_allclose(x, _test_expect1)
def test_parallel_basic(self, parallel, fn): x = combo_runner(fn, _test_combos1, num_workers=2, parallel=parallel) assert_allclose(x, _test_expect1)
def test_dict(self): combos = OrderedDict(_test_combos1) x = combo_runner(foo3_scalar, combos) assert_allclose(x, _test_expect1)
def test_single_combo_single_tuple(self): combos = ('a', [1, 2]) constants = {'b': 20, 'c': 300} x = combo_runner(foo3_scalar, combos, constants=constants) assert_allclose(x, [321, 322])
def test_single_combo(self): combos = [('a', [1, 2])] x = combo_runner(partial(foo3_scalar, b=20, c=300), combos) assert_allclose(x, [321, 322])
def test_progbars(self): combo_runner(foo3_scalar, _test_combos1, verbosity=2)
def test_parallel_dict(self, parallel): combos = OrderedDict(_test_combos1) x = [*combo_runner(foo3_scalar, combos, num_workers=2, parallel=parallel, verbosity=2)] assert_allclose(x, _test_expect1)