def setup_job_controller_noreg(): # sim_app = './my_simjob.x' if not os.path.isfile(sim_app): build_simfunc() if USE_BALSAM: from libensemble.balsam_controller import BalsamJobController jobctrl = BalsamJobController(auto_resources=False) else: from libensemble.mpi_controller import MPIJobController jobctrl = MPIJobController(auto_resources=False) jobctrl.register_calc(full_path=sim_app, calc_type='sim')
def setup_job_controller_noapp(): # sim_app = './my_simjob.x' if not os.path.isfile(sim_app): build_simfunc() if USE_BALSAM: from libensemble.balsam_controller import BalsamJobController jobctrl = BalsamJobController(auto_resources=False) else: from libensemble.mpi_controller import MPIJobController jobctrl = MPIJobController(auto_resources=False) if jobctrl.workerID is not None: sys.exit("Something went wrong in creating JobController")
# sim_app = 'simdir/my_simjob.x' # gen_app = 'gendir/my_genjob.x' # temp sim_app = './my_simjob.x' if not os.path.isfile(sim_app): build_simfunc() USE_BALSAM = False # Take as arg # USE_BALSAM = True # Take as arg # Create and add exes to registry if USE_BALSAM: from libensemble.balsam_controller import BalsamJobController jobctrl = BalsamJobController() else: from libensemble.mpi_controller import MPIJobController jobctrl = MPIJobController() jobctrl.register_calc(full_path=sim_app, calc_type='sim') # Alternative to IF could be using eg. fstring to specify: e.g: # JOB_CONTROLLER = 'Balsam' # registry = f"{JOB_CONTROLLER}Register()" # --------------- Worker: sim func ---------------------------------------- # Should work with Balsam or not def polling_loop(jobctl, job, timeout_sec=20.0, delay=2.0):
mess_resources = 'TCP comms does not support auto_resources. Auto_resources set to False' else: use_auto_resources = True mess_resources = 'Auto_resources set to True' if is_master: print('\nCores req: {} Cores avail: {}\n {}\n'.format( cores_all_jobs, logical_cores, mess_resources)) sim_app = './my_simjob.x' if not os.path.isfile(sim_app): build_simfunc() if USE_BALSAM: from libensemble.balsam_controller import BalsamJobController jobctrl = BalsamJobController(auto_resources=use_auto_resources) else: from libensemble.mpi_controller import MPIJobController jobctrl = MPIJobController(auto_resources=use_auto_resources) jobctrl.register_calc(full_path=sim_app, calc_type='sim') # if nworkers == 3: # CalcInfo.keep_worker_stat_files = True # Testing this functionality # else: # CalcInfo.keep_worker_stat_files = False # Testing this functionality sim_specs = { 'sim_f': sim_f, 'in': ['x'], 'out': [('f', float), ('cstat', int)], 'user': {