I am using MPI calls to run a procedure on multiple processes using c++. The first few lines in my Main function look like:
int main(int argc, char *argv[]){
int comm_sz;
int my_rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &comm_sz);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
x = atoi(argv[4]);
y = atoi(argv[5]);
Now when I execute and run my program using
mpiexec -n 1 program 10 10
I want x and y to be assigned the values 10 and 10, as they are the 4 and 5th arguments passed. But this isn't happening and it assigns these variables to 0 and 0 accordingly. and my program does not run as desired.
I have my serial code running when I change these numbers. Its just that I am new to MPI.
Can you suggest where am I going wrong?