| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
GaudiMP.GMPBase.Coord Class Reference
Inheritance diagram for GaudiMP.GMPBase.Coord:
[legend]
Collaboration diagram for GaudiMP.GMPBase.Coord:
[legend]

## Public Member Functions
def | __init__ (self, nWorkers, config, log)
def | getSyncEvents (self, nodeID)
def | getQueues (self, nodeID)
def | Go (self)
def | Terminate (self)
def | Stop (self)
def | SetupQueues (self)

## Public Attributes
| log
| config
| nWorkers
| qs
| hq
| fq
| sInit
| sRun
| sFin
| histSyncEvent
| subworkers
| reader
| workers
| writer
| system

## Detailed Description

Definition at line 1330 of file GMPBase.py.

## Constructor & Destructor Documentation

def GaudiMP.GMPBase.Coord.__init__ | ( |  | self,
|  |  | nWorkers,
|  |  | config,
|  |  | log
| ) |  |

Definition at line 1331 of file GMPBase.py.

1331 def __init__(self, nWorkers, config, log):
1332
1333 self.log = log
1334 self.config = config
1335 # set up Logging
1336 self.log.name = 'GaudiPython-Parallel-Logger'
1337 self.log.info('GaudiPython Parallel Process Co-ordinator beginning')
1338
1339 if nWorkers == -1:
1340 # The user has requested all available cpus in the machine
1341 self.nWorkers = cpu_count()
1342 else:
1343 self.nWorkers = nWorkers
1344
1345 self.qs = self.SetupQueues() # a dictionary of queues (for Events)
1346 self.hq = JoinableQueue() # for Histogram data
1347 self.fq = JoinableQueue() # for FileRecords data
1348
1349 # Make a Syncer for Initalise, Run, and Finalise
1350 self.sInit = Syncer(self.nWorkers, self.log,
1351 limit=WAIT_INITIALISE,
1352 step=STEP_INITIALISE)
1353 self.sRun = Syncer(self.nWorkers, self.log,
1354 manyEvents=True,
1355 limit=WAIT_SINGLE_EVENT,
1356 step=STEP_EVENT,
1357 firstEvent=WAIT_FIRST_EVENT)
1358 self.sFin = Syncer(self.nWorkers, self.log,
1359 limit=WAIT_FINALISE,
1360 step=STEP_FINALISE)
1361 # and one final one for Histogram Transfer
1362 self.histSyncEvent = Event()
1363
1364 # params are common to al subprocesses
1365 params = (self.nWorkers, self.histSyncEvent, self.config, self.log)
1366
1367 self.subworkers = []
1368 # Declare SubProcesses!
1369 for i in range(1, self.nWorkers):
1370 sub = Subworker(i, self.getQueues(
1371 i), self.getSyncEvents(i), params, self.subworkers)
1372 self.subworkers.append(sub)
1373 self.reader = Reader(self.getQueues(-1),
1374 self.getSyncEvents(-1), params, self.subworkers)
1375 self.workers = []
1376 wk = Worker(0, self.getQueues(0), self.getSyncEvents(0),
1377 params, self.subworkers)
1378 self.writer = Writer(self.getQueues(-2),
1379 self.getSyncEvents(-2), params, self.subworkers)
1380
1381 self.system = []
1382 self.system.append(self.writer)
1383 self.system.append(wk)
1384 self.system.append(self.reader)
1385
GaudiMP.GMPBase.Coord.system
system
Definition: GMPBase.py:1381
GaudiMP.GMPBase.Coord.qs
qs
Definition: GMPBase.py:1345
GaudiMP.GMPBase.Coord.SetupQueues
def SetupQueues(self)
Definition: GMPBase.py:1458
GaudiMP.GMPBase.Coord.fq
fq
Definition: GMPBase.py:1347
GaudiMP.GMPBase.Coord.nWorkers
nWorkers
Definition: GMPBase.py:1341
GaudiMP.GMPBase.Coord.config
config
Definition: GMPBase.py:1334
GaudiMP.GMPBase.Subworker
Definition: GMPBase.py:801
GaudiMP.GMPBase.Coord.hq
hq
Definition: GMPBase.py:1346
GaudiMP.GMPBase.Coord.__init__
def __init__(self, nWorkers, config, log)
Definition: GMPBase.py:1331
GaudiMP.GMPBase.Coord.histSyncEvent
histSyncEvent
Definition: GMPBase.py:1362
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:85
GaudiMP.pTools.Syncer
Definition: pTools.py:588
GaudiMP.GMPBase.Coord.sFin
sFin
Definition: GMPBase.py:1358
GaudiMP.GMPBase.Coord.reader
reader
Definition: GMPBase.py:1373
GaudiMP.GMPBase.Coord.getSyncEvents
def getSyncEvents(self, nodeID)
Definition: GMPBase.py:1386
GaudiMP.GMPBase.Writer
Definition: GMPBase.py:1208
GaudiMP.GMPBase.Coord.subworkers
subworkers
Definition: GMPBase.py:1367
GaudiMP.GMPBase.Worker
Definition: GMPBase.py:972
GaudiMP.GMPBase.Reader
Definition: GMPBase.py:669
GaudiMP.GMPBase.Coord.getQueues
def getQueues(self, nodeID)
Definition: GMPBase.py:1392
GaudiMP.GMPBase.Coord.sInit
sInit
Definition: GMPBase.py:1350
GaudiMP.GMPBase.Coord.workers
workers
Definition: GMPBase.py:1375
GaudiMP.GMPBase.Coord.log
log
Definition: GMPBase.py:1333
GaudiMP.GMPBase.Coord.writer
writer
Definition: GMPBase.py:1378
GaudiMP.GMPBase.Coord.sRun
sRun
Definition: GMPBase.py:1353

## Member Function Documentation

def GaudiMP.GMPBase.Coord.getQueues | ( |  | self,
|  |  | nodeID
| ) |  |

Definition at line 1392 of file GMPBase.py.

1392 def getQueues(self, nodeID):
1393 eventQ = self.qs[nodeID]
1394 histQ = self.hq
1395 fsrQ = self.fq
1396 return (eventQ, histQ, fsrQ)
1397
GaudiMP.GMPBase.Coord.qs
qs
Definition: GMPBase.py:1345
GaudiMP.GMPBase.Coord.fq
fq
Definition: GMPBase.py:1347
GaudiMP.GMPBase.Coord.hq
hq
Definition: GMPBase.py:1346
GaudiMP.GMPBase.Coord.getQueues
def getQueues(self, nodeID)
Definition: GMPBase.py:1392

def GaudiMP.GMPBase.Coord.getSyncEvents | ( |  | self,
|  |  | nodeID
| ) |  |

Definition at line 1386 of file GMPBase.py.

1386 def getSyncEvents(self, nodeID):
1387 init = self.sInit.d[nodeID].event
1388 run = (self.sRun.d[nodeID].event, self.sRun.d[nodeID].lastEvent)
1389 fin = self.sFin.d[nodeID].event
1390 return (init, run, fin)
1391
GaudiMP.GMPBase.Coord.getSyncEvents
def getSyncEvents(self, nodeID)
Definition: GMPBase.py:1386

def GaudiMP.GMPBase.Coord.Go | ( |  | self | ) |

Definition at line 1398 of file GMPBase.py.

1398 def Go(self):
1399
1400 # Initialise
1401 self.log.name = 'GaudiPython-Parallel-Logger'
1402 self.log.info('INITIALISING SYSTEM')
1403
1404 # Start reader, writer and main worker
1405 for p in self.system:
1406 p.Start()
1407
1408 sc = self.sInit.syncAll(step="Initialise")
1409 if sc == SUCCESS:
1410 pass
1411 else:
1412 self.Terminate()
1413 return FAILURE
1414
1415 # Run
1416 self.log.name = 'GaudiPython-Parallel-Logger'
1417 self.log.info('RUNNING SYSTEM')
1418 sc = self.sRun.syncAll(step="Run")
1419 if sc == SUCCESS:
1420 pass
1421 else:
1422 self.Terminate()
1423 return FAILURE
1424
1425 # Finalise
1426 self.log.name = 'GaudiPython-Parallel-Logger'
1427 self.log.info('FINALISING SYSTEM')
1428 sc = self.sFin.syncAll(step="Finalise")
1429 if sc == SUCCESS:
1430 pass
1431 else:
1432 self.Terminate()
1433 return FAILURE
1434
1435 # if we've got this far, finally report SUCCESS
1436 self.log.info("Cleanly join all Processes")
1437 self.Stop()
1438 self.log.info("Report Total Success to Main.py")
1439 return SUCCESS
1440
GaudiMP.GMPBase.Coord.system
system
Definition: GMPBase.py:1381
GaudiMP.GMPBase.Coord.Terminate
def Terminate(self)
Definition: GMPBase.py:1441
GaudiMP.GMPBase.Coord.Go
def Go(self)
Definition: GMPBase.py:1398
GaudiMP.GMPBase.Coord.Stop
def Stop(self)
Definition: GMPBase.py:1451

def GaudiMP.GMPBase.Coord.SetupQueues | ( |  | self | ) |

Definition at line 1458 of file GMPBase.py.

1458 def SetupQueues(self):
1459 # This method will set up the network of Queues needed
1460 # N Queues = nWorkers + 1
1461 # Each Worker has a Queue in, and a Queue out
1462 # Reader has Queue out only
1463 # Writer has nWorkers Queues in
1464
1465 # one queue from Reader-Workers
1466 rwk = JoinableQueue()
1467 # one queue from each worker to writer
1468 workersWriter = [JoinableQueue() for i in xrange(self.nWorkers)]
1469 d = {}
1470 d[-1] = (None, rwk) # Reader
1471 d[-2] = (workersWriter, None) # Writer
1472 for i in xrange(self.nWorkers):
1473 d[i] = (rwk, workersWriter[i])
1474 return d
1475
1476 # ============================= EOF ===========================================
1477
GaudiMP.GMPBase.Coord.SetupQueues
def SetupQueues(self)
Definition: GMPBase.py:1458
GaudiMP.GMPBase.Coord.nWorkers
nWorkers
Definition: GMPBase.py:1341

def GaudiMP.GMPBase.Coord.Stop | ( |  | self | ) |

Definition at line 1451 of file GMPBase.py.

1451 def Stop(self):
1452 # procs should be joined in reverse order to launch
1453 self.system.reverse()
1454 for s in self.system:
1455 s.proc.join()
1456 return SUCCESS
1457
GaudiMP.GMPBase.Coord.system
system
Definition: GMPBase.py:1381
GaudiMP.GMPBase.Coord.Stop
def Stop(self)
Definition: GMPBase.py:1451

def GaudiMP.GMPBase.Coord.Terminate | ( |  | self | ) |

Definition at line 1441 of file GMPBase.py.

1441 def Terminate(self):
1442 # Brutally kill sub-processes
1443 children = multiprocessing.active_children()
1444 for i in children:
1445 i.terminate()
1446
1447 # self.writer.proc.terminate()
1448 #[ w.proc.terminate() for w in self.workers]
1449 # self.reader.proc.terminate()
1450
GaudiMP.GMPBase.Coord.Terminate
def Terminate(self)
Definition: GMPBase.py:1441

## Member Data Documentation

GaudiMP.GMPBase.Coord.config

Definition at line 1334 of file GMPBase.py.

GaudiMP.GMPBase.Coord.fq

Definition at line 1347 of file GMPBase.py.

GaudiMP.GMPBase.Coord.histSyncEvent

Definition at line 1362 of file GMPBase.py.

GaudiMP.GMPBase.Coord.hq

Definition at line 1346 of file GMPBase.py.

GaudiMP.GMPBase.Coord.log

Definition at line 1333 of file GMPBase.py.

GaudiMP.GMPBase.Coord.nWorkers

Definition at line 1341 of file GMPBase.py.

GaudiMP.GMPBase.Coord.qs

Definition at line 1345 of file GMPBase.py.

GaudiMP.GMPBase.Coord.reader

Definition at line 1373 of file GMPBase.py.

GaudiMP.GMPBase.Coord.sFin

Definition at line 1358 of file GMPBase.py.

GaudiMP.GMPBase.Coord.sInit

Definition at line 1350 of file GMPBase.py.

GaudiMP.GMPBase.Coord.sRun

Definition at line 1353 of file GMPBase.py.

GaudiMP.GMPBase.Coord.subworkers

Definition at line 1367 of file GMPBase.py.

GaudiMP.GMPBase.Coord.system

Definition at line 1381 of file GMPBase.py.

GaudiMP.GMPBase.Coord.workers

Definition at line 1375 of file GMPBase.py.

GaudiMP.GMPBase.Coord.writer

Definition at line 1378 of file GMPBase.py.

The documentation for this class was generated from the following file:

- GaudiMP/python/GaudiMP/GMPBase.py