c - Finding the highest rank of all the processes -


i trying learn mpi. how find out process with highest rank within mpi_comm_world in mpi 3?

     mpi_init(&argc, &argv);      mpi_comm_rank(mpi_comm_world, &my_rank);      mpi_comm_size(mpi_comm_world, &p);           //more code here       mpi_finalize(); 

i know mpi_comm_rank(mpi_comm_world, &my_rank); me rank of calling process, find highest rank of processes in mpi_comm_world can make process computations.

to highest ranking process, can use mpi_comm_size(mpi_comm_world, …) determine total number of process on mpi_comm_world communicator. since every process part of communicator, , process enumerated 0, rank of highest ranking process subtract 1 mpi_comm_world's size:

int size = mpi_comm_size(mpi_comm_world, &size); int highest_rank = size - 1; 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -