How to parallelize function with MPI c++ -
i'm new on mpi , after studying basics, still not understand how leverage mpi parallel execution of 2 function, 1 first part of elements , second second part. example:
for(int = 0; < argc/2; i++){ function(el[i]); } for(int = 0; < argc-1; i++){ function(el[i]); }
how can use mpi_send, mpi_recv ecc.?
mpi multiprocessor library, not multithreading one. consequently data splitted , cannot seen single array on cores can process part of it.
here, process data, each core need have array contains half data. mpi_send , mpi_recv, this
get rank , number of proc create subarray pass parts of initial array proc 0 other procs (with mpi_send proc 0 , mpi_recv others) each proc calculation reunite results new set of send/recv
after, exists functions make data spreading , reunificating easier
good luck
Comments
Post a Comment