def Initialize(self, simname, visitdir): mpicom.init(sys.argv) VisItSetBroadcastIntFunction(self.broadcast_int) VisItSetBroadcastStringFunction(self.broadcast_string) self.par_size = mpicom.size() self.par_rank = mpicom.rank() VisItSetParallel(self.par_size >1) VisItSetParallelRank(self.par_rank) self.par_size = mpicom.size() self.par_rank = mpicom.rank() self.MP = self.M / self.par_size Simulation.Initialize(self, simname, visitdir) print self.par_rank, self.v
def Initialize(self, simname, visitdir): mpicom.init(sys.argv) VisItSetBroadcastIntFunction(self.broadcast_int) VisItSetBroadcastStringFunction(self.broadcast_string) self.par_size = mpicom.size() self.par_rank = mpicom.rank() VisItSetParallel(self.par_size > 1) VisItSetParallelRank(self.par_rank) self.par_size = mpicom.size() self.par_rank = mpicom.rank() self.MP = self.M / self.par_size Simulation.Initialize(self, simname, visitdir) print(self.par_rank, self.v)
def Initialize(self): mpicom.init(sys.argv) VisItSetBroadcastIntFunction(self.broadcast_int) VisItSetBroadcastStringFunction(self.broadcast_string) self.par_size = mpicom.size() self.par_rank = mpicom.rank() VisItSetParallel(self.par_size > 1) VisItSetParallelRank(self.par_rank)
def test(name,curr,expected): """ A basic assert equal helper. """ rank = mpicom.rank() res = "passed" if curr != expected: res = "failed" failures += 1 print "%d:%s=%s:%s" % (rank,name,repr(str(curr)),res)
def test(name, curr, expected): """ A basic assert equal helper. """ rank = mpicom.rank() res = "passed" if curr != expected: res = "failed" failures += 1 print "%d:%s=%s:%s" % (rank, name, repr(str(curr)), res)
def test(name,curr,expected): """ A basic assert equal helper. """ rank = mpicom.rank() res = "passed" if curr != expected: res = "failed" failures += 1 print "%d:%s=%s:%s" % (rank,name,repr(str(curr)),res) # fire up mpi mpicom.init(sys.argv) # get the current process id and total # of processors rank = mpicom.rank() sz = mpicom.size() # test min reduce test("min",mpicom.min(rank),0) # test max reduce test("max",mpicom.max(rank),sz-1) # test sum reduce test("sum",mpicom.sum(rank),(sz)*(sz-1)/2) # test mult reduce test("mult",mpicom.mult(rank),0) # test broadcast of integer if rank == 0: test("broadcast",mpicom.broadcast(1),None) else:
def test(name, curr, expected): """ A basic assert equal helper. """ rank = mpicom.rank() res = "passed" if curr != expected: res = "failed" failures += 1 print "%d:%s=%s:%s" % (rank, name, repr(str(curr)), res) # fire up mpi mpicom.init(sys.argv) # get the current process id and total # of processors rank = mpicom.rank() sz = mpicom.size() # test min reduce test("min", mpicom.min(rank), 0) # test max reduce test("max", mpicom.max(rank), sz - 1) # test sum reduce test("sum", mpicom.sum(rank), (sz) * (sz - 1) / 2) # test mult reduce test("mult", mpicom.mult(rank), 0) # test broadcast of integer if rank == 0: test("broadcast", mpicom.broadcast(1), None) else: