! ========================================================================= ! Print name of processor and size of communicator as seen by MPI rank 0 ! Then have every MPI process print its rank (use i3.3 for easy sorting) ! ! mpif90 -xCORE-AVX512 -O3 mpi_hello.f90 -o mpi_hello ! mpirun ./mpi_hello | sort ! ! To run on multiple nodes of a TACC cluster: ! ibrun ./mpi_hello ! ========================================================================= program mpi_hello implicit none include 'mpif.h' integer :: ierr, nranks, irank, namelen character*(MPI_MAX_PROCESSOR_NAME) :: name call MPI_Init(ierr) call MPI_Comm_size(MPI_COMM_WORLD, nranks, ierr) call MPI_Comm_rank(MPI_COMM_WORLD, irank, ierr) call MPI_Get_processor_name( name, namelen, ierr) if (irank==0) then write(*,'(" 0> Hello from Xeon SP at processor ",a36)') name write(*,'(" 0> Size of the MPI communicator is: ", i3)') nranks end if write(*,'(" => Hello from MPI process ", i3.3)') irank call MPI_Finalize(ierr) end program mpi_hello