# mpirun -n 2 python mpi_driver.py exp=xpptut15:run=54 cspad -n 10 # in batch: # bsub -q psanaq -n 2 -o %J.log -a mympi python mpi_driver.py exp=xpptut15:run=54 #from master_PUB import runmaster from master import runmaster from worker import runworker from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() assert size>1, 'At least 2 MPI ranks required' numClients = size-1 import argparse parser = argparse.ArgumentParser() parser.add_argument("exprun", help="psana experiment/run string (e.g. exp=xppd7114:run=43)") parser.add_argument("-n","--noe",help="number of events, all events=0",default=-1, type=int) args = parser.parse_args() if rank==0: runmaster(numClients) else: runworker(args) MPI.Finalize()
from master import runmaster from client import runclient import signal from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() assert size > 1, 'At least 2 MPI ranks required' numClients = size - 1 import cfg # Catch ctrl-C def signal_handler(signal, fame): print 'Correlation plotting terminated.' sys.exit() signal.signal(signal.SIGINT, signal_handler) cfg = cfg.get_cfg() if rank == 0: runmaster(numClients, cfg) else: runclient(cfg) MPI.Finalize()
largestRun = c if (largestRun[1] == 999): largestRun[1] = 'end' print('final file choice is ' + str(largestRun[0]) + '-' + str(largestRun[1]) + '.txt') import ConfigParser config = ConfigParser.RawConfigParser() config.read('thresholds/' + str(largestRun[0]) + '-' + str(largestRun[1]) + '.txt') # getfloat() raises an exception if the value is not a float # getint() and getboolean() also do this for their respective types thresh =dict() thresh['tof'] = config.getfloat('Thresholds', 'tof') thresh['diode'] = config.getfloat('Thresholds', 'diode') thresh['tofUpper'] = config.getfloat('Thresholds', 'tofUpper') thresh['image'] = config.getfloat('Thresholds', 'image') print('threshs', thresh['tof'], thresh['diode']) if rank==0: maskplot = Image(0,'mask',mask) publish.send('mask', maskplot) runmaster(args,numClients, mask) else: runclient(args, mask, thresh) MPI.Finalize()
# run these commands in the "amoh1315" directory # mpirun -n 2 python mpi_driver.py exp=amoh1315:run=256 -n 200 # in batch: # bsub -q psanaq -n 2 -o %J.log -a mympi python mpi_driver.py exp=amotut13:run=206 from master import runmaster from client import runclient from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() assert size>1, 'At least 2 MPI ranks required' numClients = size-1 import argparse parser = argparse.ArgumentParser() parser.add_argument("exprun", help="psana experiment/run string (e.g. exp=amoj5415:run=43)") parser.add_argument("-n","--noe",help="number of events, all events=0",default=-1, type=int) args = parser.parse_args() if rank==0: runmaster(args,numClients) else: runclient(args) MPI.Finalize()