1 """
2 Class that implements the common functionality for running cases in parallel
3 """
4 from optparse import OptionGroup
5
6 from PyFoam.Execution.ParallelExecution import LAMMachine
7
9 """ The class that defines options for parallel execution
10 """
11
13 grp=OptionGroup(self.parser,
14 "Parallel",
15 "Defines whether and on how many processors a parallel run should be executed")
16
17 grp.add_option("--procnr",
18 type="int",
19 dest="procnr",
20 default=None,
21 help="The number of processors the run should be started on")
22
23 grp.add_option("--machinefile",
24 dest="machinefile",
25 default=None,
26 help="The machinefile that specifies the parallel machine")
27 self.parser.add_option_group(grp)
28
30 lam=None
31 if self.opts.procnr!=None or self.opts.machinefile!=None:
32 lam=LAMMachine(machines=self.opts.machinefile,nr=self.opts.procnr)
33 return lam
34