/[escript]/branches/split/test.py
ViewVC logotype

Contents of /branches/split/test.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4746 - (show annotations)
Thu Mar 13 06:23:15 2014 UTC (5 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 967 byte(s)
Code to gather information about exceptions on remote worlds
and rethrow to all ranks in all worlds.

Note: If this exception brings down the world, then some ranks may be
killed by the MPI system before the exception reaches _their_ top level.


1 from esys.escript import *
2 from esys.escriptcore.splitworld import *
3
4 from esys.ripley import *
5
6
7 sw=SplitWorld(getMPISizeWorld())
8 buildDomains(sw, Brick, 3,3,3)
9
10 class J1(Job):
11 def __init__(self, **kwargs):
12 super(J1,self).__init__(**kwargs)
13 print "Constructed with "+str(self.domain)+" and id="+str(self.jobid)
14 self.rounds=self.jobid+2
15 def work(self):
16 print str(self.jobid)+"is doing work "+str(self.rounds)
17 self.rounds-=1
18 return self.rounds<1
19
20 class BarrierJob(Job):
21 def __init__(self, **kwargs):
22 super(BarrierJob,self).__init__(**kwargs)
23 self.rounds=self.jobid+2
24
25 def work(self):
26 print str(self.jobid)+"is doing work "+str(self.rounds)
27 self.rounds-=1
28 print self.domain.OnMasterProcessor()
29 return self.rounds<1
30
31 addJob(sw, J1)
32 addJob(sw, J1)
33 for z in range(1):
34 # addJob(sw, J1)
35 addJob(sw, BarrierJob)
36
37
38 try:
39 sw.runJobs()
40 except RuntimeError as e:
41 print e

  ViewVC Help
Powered by ViewVC 1.1.26