예제 #1
0
 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, ...])
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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)
예제 #6
0
 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)
예제 #7
0
 def test_simple(self):
     x = combo_runner(foo3_scalar, _test_combos1)
     assert_allclose(x, _test_expect1)
예제 #8
0
 def test_parallel_basic(self, parallel, fn):
     x = combo_runner(fn, _test_combos1, num_workers=2, parallel=parallel)
     assert_allclose(x, _test_expect1)
예제 #9
0
 def test_dict(self):
     combos = OrderedDict(_test_combos1)
     x = combo_runner(foo3_scalar, combos)
     assert_allclose(x, _test_expect1)
예제 #10
0
 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])
예제 #11
0
 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])
예제 #12
0
 def test_dict(self):
     combos = OrderedDict(_test_combos1)
     x = combo_runner(foo3_scalar, combos)
     assert_allclose(x, _test_expect1)
예제 #13
0
 def test_progbars(self):
     combo_runner(foo3_scalar, _test_combos1, verbosity=2)
예제 #14
0
 def test_progbars(self):
     combo_runner(foo3_scalar, _test_combos1, verbosity=2)
예제 #15
0
 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, ...])
예제 #16
0
 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])
예제 #17
0
 def test_parallel_basic(self, parallel, fn):
     x = combo_runner(fn, _test_combos1, num_workers=2, parallel=parallel)
     assert_allclose(x, _test_expect1)
예제 #18
0
 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])
예제 #19
0
 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)
예제 #20
0
 def test_simple(self):
     x = combo_runner(foo3_scalar, _test_combos1)
     assert_allclose(x, _test_expect1)