def wait_for_keypress(discr): """MPI-aware keypress wait""" try: comm = discr.parallel_discr.context.communicator except AttributeError: raw_input("[Enter]") else: if comm.rank == 0: # OpenMPI connects mpirun's stdin to rank 0's stdin. print "[Enter]" raw_input() from boostmpi import broadcast broadcast(comm, value=0, root=0)
#!/usr/bin/env python import boostmpi as mpi import sys x1, x2, x3 = None, None, None if mpi.rank == 0: x1, x2, x3 = 1.2, 1.3, 1.4 #ans = raw_input('Question? ') #print ans #mpi.world.barrier() x1, x2, x3 = mpi.broadcast(mpi.world, root=0, value=(x1, x2, x3)) print mpi.rank, x1, x2, x3 mpi.world.barrier() if mpi.rank == 0: print 'Question? (Y/n) ' ans = sys.stdin.readline()[:-1] print ans
h5group_ngpu = fd.create_group(grp_name) except ValueError: print "'/%s' group is already present." % grp_name print 'Do you want to remove the existing group? (y/N)' ans = sys.stdin.readline() if ans == 'Y\n' or ans == 'y\n': del fd[grp_name] h5group_ngpu = fd.create_group(grp_name) elif ans == 'N\n' or ans == 'n\n' or ans == '\n': h5group_ngpu = fd[grp_name] else: sys.exit() m_list, num_float, num_gpus, num_avg, transfer_type_list = \ mpi.broadcast( mpi.world, root=0, value=(m_list, num_float, num_gpus, num_avg, transfer_type_list) ) multi_obj = BandwidthTestMulti(m_list, num_float, num_gpus, num_avg) if 'serial' in transfer_type_list: if mpi.rank == 0: print 'GPU-PCIE-bandwidth test: serial' multi_obj.set_h5group_ngpu(h5group_ngpu) t1 = datetime.now() multi_obj.serial() dt = datetime.now() - t1 total_dt[0] = dt.seconds + dt.microseconds * 1e-6 print 'serial test end.', dt if 'mpi' in transfer_type_list: if mpi.rank == 0: print 'GPU-PCIE-bandwidth test: mpi'
#!/usr/bin/env python import boostmpi as mpi import sys x1, x2, x3 = None, None, None if mpi.rank == 0: x1, x2, x3 = 1.2, 1.3, 1.4 #ans = raw_input('Question? ') #print ans #mpi.world.barrier() x1, x2, x3 = mpi.broadcast( mpi.world, root=0, value=(x1, x2, x3) ) print mpi.rank, x1, x2, x3 mpi.world.barrier() if mpi.rank == 0: print 'Question? (Y/n) ' ans = sys.stdin.readline()[:-1] print ans
grp_name = "%dgpu" % num_gpus h5group_ngpu = fd.create_group(grp_name) except ValueError: print "'/%s' group is already present." % grp_name print "Do you want to remove the existing group? (y/N)" ans = sys.stdin.readline() if ans == "Y\n" or ans == "y\n": del fd[grp_name] h5group_ngpu = fd.create_group(grp_name) elif ans == "N\n" or ans == "n\n" or ans == "\n": h5group_ngpu = fd[grp_name] else: sys.exit() m_list, num_float, num_gpus, num_avg, transfer_type_list = mpi.broadcast( mpi.world, root=0, value=(m_list, num_float, num_gpus, num_avg, transfer_type_list) ) multi_obj = BandwidthTestMulti(m_list, num_float, num_gpus, num_avg) if "serial" in transfer_type_list: if mpi.rank == 0: print "GPU-PCIE-bandwidth test: serial" multi_obj.set_h5group_ngpu(h5group_ngpu) t1 = datetime.now() multi_obj.serial() dt = datetime.now() - t1 total_dt[0] = dt.seconds + dt.microseconds * 1e-6 print "serial test end.", dt if "mpi" in transfer_type_list: if mpi.rank == 0: