Can I reset MPI instance in c++? -
i wrote sort algorithm mpi. recursive mergesort, left child sorts half array within same process parent whereas right child gets new process , receives half array parent sends sorted array parent. need sort bunch of integer files. here current design:
int main() { mpi_init(); if(my_rank == 0) { foreach data file { sort_mpi(array); } } else { mpi_recv(right_array...); sort_mpi(right_array); mpi_finalize(); } mpi_finalize(); }
with code, first file gets sorted , moves on next file. in second interation of loop, stays in rank 0 , never goes rank 1. should ideal if can reset mpi instance before going next file. there way that?
you not need reset mpi - need have point instances "freezing" in, , continuing after instances got point...
since it's homework - won't tell method name, hope helps.
think design of sort, , state need nodes in, when, , how enforce it.
this example might helpful (hoping not solve homework, leading in right direction) bitonic sorting mpi
Comments
Post a Comment