MPI rank process -


i mpi beginner, 'd know definition of rank of mpi program, , why need it

for example, there 2 lines of code here:

int world_rank; mpi_comm_rank(mpi_comm_world, &world_rank); 

enter image description here

to understand this, need realise mpi uses spmd (single program multiple data) model. means if run program in parallel, e.g. on 4 processes @ same time, every process runs own independent copy of same program. so, basic question is: why doesn't every process same thing? make use of parallel programming, need processes different things. example, might want 1 process act controller sending jobs multiple workers. rank fundamental identifier each process. if run on 4 processes, above program return ranks of 0, 1, 2 , 3 on different processes. once process knows rank can act appropriately, e.g. "if rank 0 call controller function else call worker function".


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -