# -------------------------------------------------------------------------- modeller = PyEMMAAnalysis(pdb_file=pdb_file, source_folder=File('../staging_area/ntl9/trajs')) # -------------------------------------------------------------------------- # CREATE THE SESSION # the instance that runs the simulations on the resource # -------------------------------------------------------------------------- # add the task generating capabilities project.register(engine) project.register(modeller) project.open() scheduler = project.get_scheduler(cores=2) trajs = project.new_trajectory(pdb_file, 100, 4) # submit the trajectories scheduler.submit(trajs) def task_generator(): return [engine.run(traj) for traj in project.new_ml_trajectory(100, 2)] scheduler.add_event(Event().on(project.on_ntraj(range( 4, 50, 2))).do(task_generator)) # todo: change that this will stop when the first event is done scheduler.add_event(Event().on(project.on_ntraj(10)).do( modeller.task_run_msm).repeat().until(project.on_ntraj(20)))
args='-r --report-interval 1 --store-interval 1').named('openmm') # -------------------------------------------------------------------------- # CREATE AN ANALYZER # the instance that knows how to compute a msm from the trajectories # -------------------------------------------------------------------------- modeller = PyEMMAAnalysis(pdb_file=pdb_file).named('pyemma') project.generators.add(engine) project.generators.add(modeller) # -------------------------------------------------------------------------- # CREATE THE CLUSTER # the instance that runs the simulations on the resource # -------------------------------------------------------------------------- scheduler = project.get_scheduler('gpu') # print scheduler.rp_resource_name # print scheduler.resource.resource trajectories = project.new_trajectory(engine['pdb_file'], 100, 4) task = engine.run(trajectories) scheduler(task) scheduler.wait() scheduler.exit() project.close()
# CREATE AN ANALYZER # the instance that knows how to compute a msm from the trajectories # -------------------------------------------------------------------------- modeller = PyEMMAAnalysis(pdb_file=pdb_file).named('pyemma') project.generators.add(engine) project.generators.add(modeller) # -------------------------------------------------------------------------- # CREATE THE CLUSTER # the instance that runs the simulations on the resource # -------------------------------------------------------------------------- gpu_scheduler = [ project.get_scheduler('gpu', runtime=4 * 24 * 60) for _ in range(4) ] pyemma_scheduler = project.get_scheduler('cpu', cores=1, runtime=4 * 24 * 60) # create 4 trajectories trajectories = project.new_trajectory(pdb_file, 100, 4) gpu_scheduler[0](trajectories) gpu_scheduler[0].wait() # now start adaptive loop def strategy_trajectory(scheduler, loops, num): for loop in range(loops): trajectories = [ project.new_ml_trajectory(length=20, number=4)
# -------------------------------------------------------------------------- # CREATE AN ANALYZER # the instance that knows how to compute a msm from the trajectories # -------------------------------------------------------------------------- modeller = PyEMMAAnalysis(pdb_file=pdb_file).named('pyemma') project.generators.add(engine) project.generators.add(modeller) # -------------------------------------------------------------------------- # CREATE THE CLUSTER # the instance that runs the simulations on the resource # -------------------------------------------------------------------------- scheduler = project.get_scheduler('gpu', cores=1, runtime=4 * 24 * 60) # create 4 blocks a 4 trajectories trajectories = [ project.new_trajectory(engine['pdb_file'], 100, 4) for _ in range(4) ] tasks = map(engine.run, trajectories) print trajectories # submit scheduler(tasks) scheduler.wait() # now start adaptive loop
# -------------------------------------------------------------------------- # CREATE AN ANALYZER # the instance that knows how to compute a msm from the trajectories # -------------------------------------------------------------------------- modeller = PyEMMAAnalysis(pdb_file=pdb_file).named('pyemma') project.generators.add(engine) project.generators.add(modeller) # -------------------------------------------------------------------------- # CREATE THE CLUSTER # the instance that runs the simulations on the resource # -------------------------------------------------------------------------- scheduler1 = project.get_scheduler('cpu', cores=4, runtime=4 * 24 * 60) scheduler2 = project.get_scheduler('cpu', cores=16, runtime=4 * 24 * 60) scheduler3 = project.get_scheduler('cpu', cores=1, runtime=4 * 24 * 60) # create 4 trajectories trajectories = project.new_trajectory(pdb_file, 100, 4) scheduler1(trajectories) scheduler1.wait() # now start adaptive loop def strategy_trajectory(scheduler, loops): for loop in range(loops): trajectories = project.new_ml_trajectory(length=20, number=4) tasks = scheduler(trajectories) yield tasks.is_done()
# CREATE THE MODELLER # the instance to create msm models # -------------------------------------------------------------------------- modeller = PyEMMAAnalysis( pdb_file=pdb_file, source_folder=File('../staging_area/ntl9/trajs')) # add the task generating capabilities project.register(engine) project.register(modeller) # todo: save the task_generators for later in the project with project: # lets get the default scheduler from the resource with all the scheduler = project.get_scheduler('gpu', cores=4) trajs = project.new_trajectory(pdb_file, 100, 4) # submit the trajectories scheduler.submit(trajs) def task_generator(): return [ engine.run(traj) for traj in scheduler.new_ml_trajectory(100, 2)] scheduler.add_event( Event() .on(scheduler.on_ntraj(range(10, 50, 10))) .do(task_generator))