def get_gpu_message(): """ Returns a string with information about the currently selected GPU. """ gpu = cuda.gpus.current # Convert bytestring to actual string try: gpu_name = gpu.name.decode() except AttributeError: gpu_name = gpu.name # Print the GPU that is being used if MPI.COMM_WORLD.size > 1: rank = MPI.COMM_WORLD.rank node = MPI.Get_processor_name() message = "\nMPI rank %d selected a %s GPU with id %s on node %s" % ( rank, gpu_name, gpu.id, node) else: message = "\nFBPIC selected a %s GPU with id %s" % (gpu_name, gpu.id) if mpi_installed: node = MPI.Get_processor_name() message += " on node %s" % node # Print the GPU UUID, if available uuid = get_uuid(gpu.id) if uuid is not None: message += "\n(GPU UUID: %s)" % uuid return (message)
def get_cpu_message(): """ Returns a string with information about the node of each MPI rank """ # Print the node that is being used if MPI.COMM_WORLD.size > 1: rank = MPI.COMM_WORLD.rank node = MPI.Get_processor_name() message = "\nMPI rank %d runs on node %s" % (rank, node) else: message = "" return (message)
def get_gpu_message(): """ Returns a string with information about the currently selected GPU. """ gpu = cuda.gpus.current # Convert bytestring to actual string try: gpu_name = gpu.name.decode() except AttributeError: gpu_name = gpu.name # Print the GPU that is being used if MPI.COMM_WORLD.size > 1: rank = MPI.COMM_WORLD.rank node = MPI.Get_processor_name() message = "\nMPI rank %d selected a %s GPU with id %s on node %s" % ( rank, gpu_name, gpu.id, node) else: message = "\nFBPIC selected a %s GPU with id %s" % (gpu_name, gpu.id) return (message)
def print_simulation_setup(sim, verbose_level=1): """ Print information about the simulation. - Version of FBPIC - CPU or GPU computation - Number of parallel MPI domains - Number of threads in case of CPU multi-threading - (Additional detailed information) Parameters ---------- sim: an fbpic Simulation object Contains all the information of the simulation setup verbose_level: int, optional Level of detail of the simulation information 0 - Print no information 1 (Default) - Print basic information 2 - Print detailed information """ if verbose_level > 0: # Print version of FBPIC message = '\nFBPIC (%s)\n' % __version__ # Basic information if verbose_level == 1: # Print information about computational setup if sim.use_cuda: message += "\nRunning on GPU " else: message += "\nRunning on CPU " if sim.comm.size > 1: message += "with %d MPI processes " % sim.comm.size if sim.use_threading and not sim.use_cuda: message += "(%d threads per process) " % sim.cpu_threads # Detailed information elif verbose_level == 2: # Information on MPI if mpi_installed: message += '\nMPI available: Yes' message += '\nMPI processes used: %d' % sim.comm.size message += '\nMPI Library Information: \n%s' \ %MPI.Get_library_version() else: message += '\nMPI available: No' # Information on Cuda if cuda_installed: message += '\nCUDA available: Yes' else: message += '\nCUDA available: No' # Information about the architecture and the node used if sim.use_cuda: message += '\nCompute architecture: GPU (CUDA)' if mpi_installed: if gpudirect_enabled: message += '\nCUDA GPUDirect (MPI) enabled: Yes' else: message += '\nCUDA GPUDirect (MPI) enabled: No' node_message = get_gpu_message() else: message += '\nCompute architecture: CPU' if sim.use_threading: message += '\nCPU multi-threading enabled: Yes' message += '\nThreads: %s' % sim.cpu_threads else: message += '\nCPU multi-threading enabled: No' if sim.fld.trans[0].fft.use_mkl: message += '\nFFT library: MKL' else: message += '\nFFT library: pyFFTW' node_message = get_cpu_message() # Gather the information about where each node runs if sim.comm.size > 1: node_messages = sim.comm.mpi_comm.gather(node_message) if sim.comm.rank == 0: node_message = ''.join(node_messages) message += node_message message += '\n' # Information on the numerical algorithm if sim.fld.n_order == -1: message += '\nPSATD stencil order: infinite' else: message += '\nPSATD stencil order: %d' % sim.fld.n_order message += '\nParticle shape: %s' % sim.particle_shape message += '\nLongitudinal boundaries: %s' % sim.comm.boundaries[ 'z'] message += '\nTransverse boundaries: %s' % sim.comm.boundaries['r'] message += '\nGuard region size: %d ' % sim.comm.n_guard + 'cells' message += '\nDamping region size: %d ' % sim.comm.nz_damp + 'cells' message += '\nInjection region size: %d ' % sim.comm.n_inject + 'cells' message += '\nParticle exchange period: every %d ' \ %sim.comm.exchange_period + 'step' if sim.boost is not None: message += '\nBoosted frame: Yes' message += '\nBoosted frame gamma: %d' % sim.boost.gamma0 if sim.use_galilean: message += '\nGalilean frame: Yes' else: message += '\nGalilean frame: No' else: message += '\nBoosted frame: False' message += '\n' # Only processor 0 prints the message: if sim.comm.rank == 0: print(message)