#include "mpi.h" #include int main(int argc, char *argv[]) { int myrank, nprocs, nameln; char name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&myrank); MPI_Get_processor_name(name, &nameln); printf("Hello! My rank is %d. My hostname is \"%s\"\n", myrank, name); MPI_Finalize(); }