Skip to content

Commit

Permalink
Still unsure about YAPF
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Apr 24, 2019
1 parent 7f8e935 commit d4ca524
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
3 changes: 2 additions & 1 deletion libensemble/gen_funcs/aposmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
'aposmm_logic', 'initialize_APOSMM', 'decide_where_to_start_localopt',
'update_history_dist']

import sys, os, traceback
import sys
import traceback
import numpy as np
# import scipy as sp
from scipy.spatial.distance import cdist, pdist, squareform
Expand Down
33 changes: 16 additions & 17 deletions libensemble/tests/regression_tests/test_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
if libE_specs['comms'] != 'mpi':
quit()

# Prob wrap this in the future libe comms module - and that will have init_comms...
# and can report what its using - for comms - and in mpi case for packing/unpacking
# Using dill seems more reliable on Bebop - less unpickle errors
# Prob wrap this in the future libE comms module - and that will have
# init_comms... and can report what its using - for comms - and in mpi case
# for packing/unpacking Using dill seems more reliable on Bebop - less unpickle
# errors
USE_DILL = False # True/False (req: pip install dill)

if USE_DILL:
Expand All @@ -41,21 +42,19 @@
rounds = 2 # Number of work units for each worker
sim_max = nworkers*rounds

sim_specs = {
'sim_f': sim_f,
'in': ['x'],
'out': [('arr_vals', float, array_size), ('scal_val', float)],}
sim_specs = {'sim_f': sim_f,
'in': ['x'],
'out': [('arr_vals', float, array_size), ('scal_val', float)]}

gen_specs = {
'gen_f': gen_f,
'in': ['sim_id'],
'out': [('x', float, (2,))],
'lb': np.array([-3, -2]),
'ub': np.array([3, 2]),
'gen_batch_size': sim_max,
'batch_mode': True,
'num_active_gens': 1,
'save_every_k': 300,}
gen_specs = {'gen_f': gen_f,
'in': ['sim_id'],
'out': [('x', float, (2,))],
'lb': np.array([-3, -2]),
'ub': np.array([3, 2]),
'gen_batch_size': sim_max,
'batch_mode': True,
'num_active_gens': 1,
'save_every_k': 300}

persis_info = per_worker_stream({}, nworkers+1)

Expand Down
31 changes: 16 additions & 15 deletions libensemble/tests/regression_tests/test_nan_func_aposmm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# """
# Runs libEnsemble on a function that returns only nan; tests APOSMM functionality
# Runs libEnsemble on a function that returns only nan; tests APOSMM
# functionality
#
# Execute via the following command:
# mpiexec -np 4 python3 test_nan_func_aposmm.py
Expand All @@ -12,30 +13,30 @@
from libensemble.libE import libE
from support import nan_func as sim_f, aposmm_gen_out as gen_out
from libensemble.gen_funcs.aposmm import aposmm_logic as gen_f
from libensemble.tests.regression_tests.common import parse_args, save_libE_output, per_worker_stream
from libensemble.tests.regression_tests.common import (parse_args,
save_libE_output,
per_worker_stream)

nworkers, is_master, libE_specs, _ = parse_args()
if libE_specs['comms'] == 'local':
quit()

n = 2

sim_specs = {
'sim_f': sim_f,
'in': ['x'],
'out': [('f', float), ('f_i', float)]}
sim_specs = {'sim_f': sim_f,
'in': ['x'],
'out': [('f', float), ('f_i', float)]}

gen_out += [('x', float, n), ('x_on_cube', float, n), ('obj_component', int)]

gen_specs = {
'gen_f': gen_f,
'in': [o[0] for o in gen_out]+['f', 'f_i', 'returned'],
'out': gen_out,
'lb': -2*np.ones(n),
'ub': 2*np.ones(n),
'initial_sample_size': 5,
'num_active_gens': 1,
'batch_mode': True,}
gen_specs = {'gen_f': gen_f,
'in': [o[0] for o in gen_out]+['f', 'f_i', 'returned'],
'out': gen_out,
'lb': -2*np.ones(n),
'ub': 2*np.ones(n),
'initial_sample_size': 5,
'num_active_gens': 1,
'batch_mode': True}

if nworkers == 3:
gen_specs['single_component'] = True
Expand Down
2 changes: 1 addition & 1 deletion libensemble/tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ if [ "$root_found" = true ]; then
#sh - shld active_runs be prefixed for each job
filelist=(*.$REG_TEST_OUTPUT_EXT); [ -e ${filelist[0]} ] && mv *.$REG_TEST_OUTPUT_EXT output/
filelist=(*.npy); [ -e ${filelist[0]} ] && mv *.npy output/
filelist=(*active_runs.txt); [ -e ${filelist[0]} ] && mv *active_runs.txt output/
filelist=(*.pickle); [ -e ${filelist[0]} ] && mv *.pickle output/

if [ "$RUN_COV_TESTS" = true ]; then

Expand Down

0 comments on commit d4ca524

Please sign in to comment.