why do you need to pass size and rank of MPI process from outside? you can get them directly from MPI functions.