Hello.
Please note the instruction at line 105 (the MPI_Alltoall call) and the comment on the line 108.
You only need to run the program once.
The program takes 3 arguments from the command line:
1-How many numbers does each processor produce locally
2-The range bounds of numbers to produces randomly(like , say, 2 to 20, entered as 2 20)
so to run, e.g, type mpirun -n 4 ./a.out 4 0 15
Note that the number of processors should be a power of 2
I personally think that maybe the reason for this bug is that the index and the size of each dimension are ignored and that only the base address and the displacement is assumed.
I read in Intel developer's manual that you need 4 parameters to access an element of a multi-dimensional array. I wonder if you can apply this.