예제 #1
0
 def test_io(self):
     tempfilename = self.tempfilename
     tempfile = masterslave.open(tempfilename, mode='w')
     tempfile.write(str(masterslave.rank()) + '\n')
     tempfile.flush()
     contents = ''
     with open(tempfilename) as stillopen:
         contents = stillopen.read()
     assert_in(str(masterslave.rank()) + '\n', contents)
     tempfile.close()
     with open(tempfilename) as nowclosed:
         ranks = [int(s.strip()) for s in nowclosed]
     assert_equal(set(ranks), set(range(masterslave.size())))
     tempfile = masterslave.open(tempfilename, 'a')
     tempfile.write(str(masterslave.rank()) + '\n')
     tempfile.close()
     with open(tempfilename) as nowclosed:
         ranks = [int(s.strip()) for s in nowclosed]
     assert_equal(len(ranks), masterslave.size() * 2)
     assert_equal(set(ranks), set(range(masterslave.size())))
     if masterslave.size() != 1:
         masterslave._comm.Barrier()
예제 #2
0
 def func(d1, d2):
     return d1, d2, masterslave.rank()
예제 #3
0
 def func(dummy):
     return dummy, masterslave.rank()