def test_get_global_nodelist_frm_wrklst_file(): # worker_list file should override env variables os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "20-22,137-139,1234" # Should not be this exp_out = [ 'knl-0019', 'knl-0021', 'knl-0022', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-2345' ] # Should be this open('worker_list', 'w').close() try: _ = Resources.get_global_nodelist(rundir=os.getcwd()) except ResourcesException as e: assert e.args[0] == 'Error. global_nodelist is empty' else: assert 0 with open('worker_list', 'w') as f: for node in exp_out: f.write(node + '\n') # Do not specify env vars. global_nodelist1 = Resources.get_global_nodelist(rundir=os.getcwd()) assert global_nodelist1 == exp_out, "global_nodelist returned does not match expected" # Specify env vars - should ignore env_resources = EnvResources( nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="LIBE_RESOURCES_TEST_NODE_LIST", nodelist_env_lsf="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf_shortform="THIS_ENV_VARIABLE_IS_DEF_NOT_SET") global_nodelist2 = Resources.get_global_nodelist( rundir=os.getcwd(), env_resources=env_resources) assert global_nodelist2 == exp_out, "global_nodelist returned does not match expected" os.remove('worker_list')
def test_cobalt_nodelist_reverse_grp(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "20-22,139-137,1234" exp_out = [ 'nid00020', 'nid00021', 'nid00022', 'nid00137', 'nid00138', 'nid00139', 'nid01234' ] nodelist = Resources.get_cobalt_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_get_available_nodes_distrib_mode_host_not_in_list(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-[0020-0022,0036,0137-0139,1234]" resources = Resources(nodelist_env_slurm="LIBE_RESOURCES_TEST_NODE_LIST", central_mode=False) #Spoof current process as each worker and check nodelist. resources.num_workers = 8 exp_out = [['knl-0020'], ['knl-0021'], ['knl-0022'], ['knl-0036'], ['knl-0137'], ['knl-0138'], ['knl-0139'], ['knl-1234']] # Test running distributed mode without current host in list. resources.workerID = 2 try: local_nodelist = resources.get_available_nodes() except: assert 1 else: assert 0
def test_slurm_nodelist_groups(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-[0020-0022,0137-0139,1234]" exp_out = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234' ] nodelist = Resources.get_slurm_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_get_global_nodelist_frm_cobalt(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "20-22,137-139,1234" exp_out = ['20', '21', '22', '137', '138', '139', '1234'] env_resources = EnvResources( nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="LIBE_RESOURCES_TEST_NODE_LIST", nodelist_env_lsf="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf_shortform="THIS_ENV_VARIABLE_IS_DEF_NOT_SET") global_nodelist = Resources.get_global_nodelist( rundir=os.getcwd(), env_resources=env_resources) assert global_nodelist == exp_out, "global_nodelist returned does not match expected"
def test_remove_libE_nodes(): mynode = socket.gethostname() exp_out = [ 'knl-0019', 'knl-0021', 'knl-0022', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-2345' ] # Add at beginning nodes_in = [mynode] + exp_out nodes_out = Resources.remove_nodes(nodes_in, mynode) assert nodes_out == exp_out, "nodelist returned does not match expected" # Add twice in middle and at end nodes_in = [] for i, node in enumerate(exp_out): nodes_in.append(node) if i == 1 or i == 4 or i == 6: nodes_in.append(mynode) nodes_out = Resources.remove_nodes(nodes_in, mynode) assert nodes_out == exp_out, "nodelist returned does not match expected"
def test_slurm_nodelist_groups_longprefix(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "super-[000020-000022,000137-000139,001234,023456-023458]" exp_out = [ 'super-000020', 'super-000021', 'super-000022', 'super-000137', 'super-000138', 'super-000139', 'super-001234', 'super-023456', 'super-023457', 'super-023458' ] nodelist = Resources.get_slurm_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_get_available_nodes_distrib_mode_uneven_split(): mynode = socket.gethostname() nodelist_in = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234' ] with open('worker_list', 'w') as f: for i, node in enumerate(nodelist_in): f.write(node + '\n') if i == 4: f.write(mynode + '\n') resources = Resources(central_mode=False) resources.num_workers = 2 # May not be at head of list - should perhaps be warning or enforced resources.workerID = 2 exp_out = ['knl-0137', mynode, 'knl-0138', 'knl-0139'] local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" os.remove('worker_list')
def test_get_global_nodelist_standalone(): mynode = socket.gethostname() env_resources = EnvResources( nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf_shortform="THIS_ENV_VARIABLE_IS_DEF_NOT_SET") global_nodelist = Resources.get_global_nodelist( rundir=os.getcwd(), env_resources=env_resources) assert global_nodelist == [ mynode ], "global_nodelist returned does not match expected"
def test_get_local_nodelist_central_mode(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-[0020-0022,0036,0137-0139,1234]" resources = Resources(nodelist_env_slurm="LIBE_RESOURCES_TEST_NODE_LIST", central_mode=True) # Now mock up some more stuff - so consistent # Spoof current process as each worker and check nodelist. num_workers = 8 exp_out = [['knl-0020'], ['knl-0021'], ['knl-0022'], ['knl-0036'], ['knl-0137'], ['knl-0138'], ['knl-0139'], ['knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Spoof current process as each worker and check nodelist. num_workers = 4 exp_out = [['knl-0020', 'knl-0021'], ['knl-0022', 'knl-0036'], ['knl-0137', 'knl-0138'], ['knl-0139', 'knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Spoof current process as each worker and check nodelist. num_workers = 1 exp_out = [[ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234' ]] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Test the best_split algorithm num_workers = 3 exp_out = [['knl-0020', 'knl-0021', 'knl-0022'], ['knl-0036', 'knl-0137', 'knl-0138'], ['knl-0139', 'knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected"
def test_get_global_nodelist_frm_cobalt(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "20-22,137-139,1234" exp_out = [ 'nid00020', 'nid00021', 'nid00022', 'nid00137', 'nid00138', 'nid00139', 'nid01234' ] global_nodelist = Resources.get_global_nodelist( rundir=os.getcwd(), central_mode=False, nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="LIBE_RESOURCES_TEST_NODE_LIST") assert global_nodelist == exp_out, "global_nodelist returned does not match expected"
def test_get_global_nodelist_frm_lsf_shortform(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = 'batch5 1 g06n02 42 h21n18 42' exp_out = ['g06n02', 'h21n18'] env_resources = EnvResources( nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_lsf_shortform="LIBE_RESOURCES_TEST_NODE_LIST") global_nodelist = Resources.get_global_nodelist( rundir=os.getcwd(), env_resources=env_resources) assert global_nodelist == exp_out, "global_nodelist returned does not match expected"
def test_get_global_nodelist_frm_wrklst_file(): # worker_list file should override env variables os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "20-22,137-139,1234" # Should not be this exp_out = [ 'knl-0019', 'knl-0021', 'knl-0022', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-2345' ] # Should be this #Try empty (really want to start testing error messages - should be "Error. global_nodelist is empty" open('worker_list', 'w').close() try: global_nodelist0 = Resources.get_global_nodelist(rundir=os.getcwd(), central_mode=False) except: assert 1 else: assert 0 with open('worker_list', 'w') as f: for node in exp_out: f.write(node + '\n') # Do not specify env vars. global_nodelist1 = Resources.get_global_nodelist(rundir=os.getcwd(), central_mode=False) assert global_nodelist1 == exp_out, "global_nodelist returned does not match expected" # Specify env vars - should ignore global_nodelist2 = Resources.get_global_nodelist( rundir=os.getcwd(), central_mode=False, nodelist_env_slurm="THIS_ENV_VARIABLE_IS_DEF_NOT_SET", nodelist_env_cobalt="LIBE_RESOURCES_TEST_NODE_LIST") assert global_nodelist2 == exp_out, "global_nodelist returned does not match expected" os.remove('worker_list')
def test_worker_resources(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-[0020-0022,0036,0137-0139,1234]" resources = Resources(nodelist_env_slurm="LIBE_RESOURCES_TEST_NODE_LIST", central_mode=True) # One worker per node exp_nodelist1 = [['knl-0020'], ['knl-0021'], ['knl-0022'], ['knl-0036'], ['knl-0137'], ['knl-0138'], ['knl-0139'], ['knl-1234']] num_workers = 8 comm = Fake_comm(num_workers) for wrk in range(num_workers): workerID = wrk + 1 worker = WorkerResources(workerID, comm, resources) assert worker.num_workers == 8, 'worker.num_workers does not match' assert worker.workerID == workerID, 'worker.workerID does not match' assert worker.local_nodelist == exp_nodelist1[ wrk], 'worker.local_nodelist does not match' assert worker.local_node_count == 1, 'worker.local_node_count does not match' assert worker.workers_per_node == 1, 'worker.workers_per_node does not match' # Multiple nodes per worker exp_nodelist2 = [['knl-0020', 'knl-0021', 'knl-0022', 'knl-0036'], ['knl-0137', 'knl-0138', 'knl-0139', 'knl-1234']] num_workers = 2 comm2 = Fake_comm(num_workers) for wrk in range(num_workers): workerID = wrk + 1 worker = WorkerResources(workerID, comm2, resources) assert worker.num_workers == 2, 'worker.num_workers does not match' assert worker.workerID == workerID, 'worker.workerID does not match' assert worker.local_nodelist == exp_nodelist2[ wrk], 'worker.local_nodelist does not match' assert worker.local_node_count == 4, 'worker.local_node_count does not match' assert worker.workers_per_node == 1, 'worker.workers_per_node does not match' # Multiple workers per node num_workers = 16 comm3 = Fake_comm(num_workers) for wrk in range(num_workers): workerID = wrk + 1 worker = WorkerResources(workerID, comm3, resources) assert worker.num_workers == 16, 'worker.num_workers does not match' assert worker.workerID == workerID, 'worker.workerID does not match' assert worker.local_nodelist == exp_nodelist1[ wrk // 2], 'worker.local_nodelist does not match' assert worker.local_node_count == 1, 'worker.local_node_count does not match' assert worker.workers_per_node == 2, 'worker.workers_per_node does not match'
def test_get_local_nodelist_distrib_mode_host_not_in_list(): os.environ[ "LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-[0020-0022,0036,0137-0139,1234]" resources = Resources(nodelist_env_slurm="LIBE_RESOURCES_TEST_NODE_LIST", central_mode=False) # Spoof current process as each worker and check nodelist. num_workers = 4 exp_out = ['knl-0022', 'knl-0036'] # Test running distributed mode without current host in list. workerID = 2 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) # Now this should work assert local_nodelist == exp_out, "local_nodelist returned does not match expected"
def test_get_local_nodelist_distrib_mode(): mynode = socket.gethostname() # nodelist_in = ['knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234'] nodelist_in = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139' ] with open('worker_list', 'w') as f: for i, node in enumerate(nodelist_in): f.write(node + '\n') if i == 3: f.write(mynode + '\n') resources = Resources(central_mode=False) # Spoof current process as each worker and check nodelist. num_workers = 8 # Test workerID not in local_nodelist [update: This should now work - check removed] # workerID = 4 # try: # local_nodelist = WorkerResources.get_local_nodelist(num_workers, workerID, resources) # except: # assert 1 # else: # assert 0 workerID = 5 exp_out = [mynode] local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out, "local_nodelist returned does not match expected" num_workers = 1 workerID = 1 exp_out = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', mynode, 'knl-0137', 'knl-0138', 'knl-0139' ] local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out, "local_nodelist returned does not match expected" num_workers = 4 workerID = 3 exp_out = [mynode, 'knl-0137'] local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out, "local_nodelist returned does not match expected" # Sub-node workers num_workers = 16 workerID = 9 exp_out = [mynode] local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out, "local_nodelist returned does not match expected" workerID = 10 exp_out = [mynode] local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out, "local_nodelist returned does not match expected" os.remove('worker_list')
def test_get_local_nodelist_central_mode_remove_libE_proc(): mynode = socket.gethostname() nodelist_in = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234' ] with open('worker_list', 'w') as f: for i, node in enumerate(nodelist_in): f.write(node + '\n') if i == 3: f.write(mynode + '\n') resources = Resources(central_mode=True) resources.add_comm_info(libE_nodes=mynode) # Now mock up some more stuff - so consistent # Spoof current process as each worker and check nodelist. num_workers = 8 exp_out = [['knl-0020'], ['knl-0021'], ['knl-0022'], ['knl-0036'], ['knl-0137'], ['knl-0138'], ['knl-0139'], ['knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Spoof current process as each worker and check nodelist. num_workers = 4 exp_out = [['knl-0020', 'knl-0021'], ['knl-0022', 'knl-0036'], ['knl-0137', 'knl-0138'], ['knl-0139', 'knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Spoof current process as each worker and check nodelist. num_workers = 1 exp_out = [[ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139', 'knl-1234' ]] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" # Test the best_split algorithm num_workers = 3 exp_out = [['knl-0020', 'knl-0021', 'knl-0022'], ['knl-0036', 'knl-0137', 'knl-0138'], ['knl-0139', 'knl-1234']] for wrk in range(num_workers): workerID = wrk + 1 local_nodelist = WorkerResources.get_local_nodelist( num_workers, workerID, resources) assert local_nodelist == exp_out[ wrk], "local_nodelist returned does not match expected" os.remove('worker_list')
def test_get_available_nodes_distrib_mode(): mynode = socket.gethostname() #nodelist_in = ['knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137','knl-0138', 'knl-0139', 'knl-1234'] nodelist_in = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', 'knl-0137', 'knl-0138', 'knl-0139' ] with open('worker_list', 'w') as f: for i, node in enumerate(nodelist_in): f.write(node + '\n') if i == 3: f.write(mynode + '\n') resources = Resources(central_mode=False) #Spoof current process as each worker and check nodelist. resources.num_workers = 8 #Test workerID not in local_nodelist resources.workerID = 4 try: local_nodelist = resources.get_available_nodes() except: assert 1 else: assert 0 resources.workerID = 5 exp_out = [mynode] local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" resources.num_workers = 1 resources.workerID = 1 exp_out = [ 'knl-0020', 'knl-0021', 'knl-0022', 'knl-0036', mynode, 'knl-0137', 'knl-0138', 'knl-0139' ] local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" resources.num_workers = 4 resources.workerID = 3 exp_out = [mynode, 'knl-0137'] local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" #Sub-node workers resources.num_workers = 16 resources.workerID = 9 exp_out = [mynode] local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" resources.workerID = 10 exp_out = [mynode] #import pdb; pdb.set_trace() local_nodelist = resources.get_available_nodes() assert local_nodelist == exp_out, "local_nodelist returned does not match expected" os.remove('worker_list')
def test_cobalt_nodelist_seq(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "9-12" exp_out = ['nid00009', 'nid00010', 'nid00011', 'nid00012'] nodelist = Resources.get_cobalt_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_cobalt_nodelist_empty(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "" exp_out = [] #empty nodelist = Resources.get_cobalt_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_slurm_nodelist_bdw_seq(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "bdw-[0009-0012]" exp_out = ['bdw-0009', 'bdw-0010', 'bdw-0011', 'bdw-0012'] nodelist = Resources.get_slurm_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
def test_slurm_nodelist_single(): os.environ["LIBE_RESOURCES_TEST_NODE_LIST"] = "knl-0056" exp_out = ["knl-0056"] nodelist = Resources.get_slurm_nodelist( node_list_env="LIBE_RESOURCES_TEST_NODE_LIST") assert nodelist == exp_out, "Nodelist returned is does not match expected"
MPI.pickle.__init__(dill.dumps, dill.loads) else: MPI.pickle.dumps = dill.dumps MPI.pickle.loads = dill.loads from libensemble.libE import libE from libensemble.sim_funcs.comms_testing import float_x1000 from libensemble.gen_funcs.uniform_sampling import uniform_random_sample from libensemble.register import Register #Only being used to pass workerID from libensemble.controller import JobController #Only being used to pass workerID from libensemble.resources import Resources #Only to get number of workers registry = Register() jobctrl = JobController(registry = registry, auto_resources = False) #registry.register_calc(full_path=sim_app, calc_type='sim') #Test with no app registered. num_workers = Resources.get_num_workers() array_size = int(1e6) # Size of large array in sim_specs rounds = 2 # Number of work units for each worker sim_max = num_workers*rounds sim_specs = {'sim_f': float_x1000, # This is the function whose output is being minimized 'in': ['x'], # These keys will be given to the above function 'out': [ ('arr_vals',float,array_size), ('scal_val',float), ], } # This may not nec. be used for this test
#In future these will be in CalcInfo or Comms modules #CalcInfo from libensemble.message_numbers import EVAL_SIM_TAG, EVAL_GEN_TAG from libensemble.message_numbers import UNSET_TAG, STOP_TAG, CALC_EXCEPTION #Comms from libensemble.message_numbers import MAN_SIGNAL_KILL, MAN_SIGNAL_FINISH from libensemble.message_numbers import MAN_SIGNAL_REQ_RESEND, MAN_SIGNAL_REQ_PICKLE_DUMP from libensemble.calc_info import CalcInfo from libensemble.controller import JobController from libensemble.resources import Resources # Rem: run on import - though Manager should never be printed - workerID/rank if Resources.am_I_manager(): wrkid = 'Manager' else: wrkid = 'w' + str(Resources.get_workerID()) logger = logging.getLogger(__name__ + '(' + wrkid + ')') #For debug messages in this module - uncomment (see libE.py to change root logging level) #logger.setLevel(logging.DEBUG) #The routine worker_main currently uses MPI. Comms will be implemented using comms module in future def worker_main(c, sim_specs, gen_specs): """ Evaluate calculations given to it by the manager.