I've been suffering from an MPI bug for ages now and its driving me mad.
My master thread does the following:
and the other threads to the following:
So the master thread sends one column of the data stored in the xt, yt and zt arrays to the other threads and also sends an integer number. The problem I have is that my_id is changed by the MPI_RECV commands. The firs MPI_RECV commands changes the node's my_id to 27 (i.e. what the tag is set to), the next to 28 etc etc. This results in the program crashing when counter(my_id+1) is referenced since counter() is set to a size of 4.
Now I know I could change the counter so that its not stored in an array but that would be avoiding the problem that my_id is being changed. Am I doing something wrong with my tags? I thought the format for MPI_SSEND and MPI_RECV was MPI_SSEND (data, number of points, type of data, target node, identifier so as not to get muddled up, status, ierrr).
This has been driving me mad for ages now and I don't know what to do.
My master thread does the following:
Code:
do i = 2, nodes
call MPI_SSEND (xt(:,i), maxpoints, MPI_REAL, (i-1), 27, MPI_COMM_WORLD, status, ierr)
call MPI_SSEND (yt(:,i), maxpoints, MPI_REAL, (i-1), 28, MPI_COMM_WORLD, status, ierr)
call MPI_SSEND (zt(:,i), maxpoints, MPI_REAL, (i-1), 29, MPI_COMM_WORLD, status, ierr)
call MPI_SSEND (counter(i), 1, MPI_INTEGER, (i-1), 30, MPI_COMM_WORLD, status, ierr)
end do
and the other threads to the following:
Code:
call MPI_RECV (x_temp, maxpoints, MPI_REAL, 0, 27, MPI_COMM_WORLD, status, ierr)
call MPI_RECV (y_temp, maxpoints, MPI_REAL, 0, 28, MPI_COMM_WORLD, status, ierr)
call MPI_RECV (z_temp, maxpoints, MPI_REAL, 0, 29, MPI_COMM_WORLD, status, ierr)
call MPI_RECV (counter(my_id+1), 1, MPI_INTEGER, 0, 30, MPI_COMM_WORLD, status, ierr)
So the master thread sends one column of the data stored in the xt, yt and zt arrays to the other threads and also sends an integer number. The problem I have is that my_id is changed by the MPI_RECV commands. The firs MPI_RECV commands changes the node's my_id to 27 (i.e. what the tag is set to), the next to 28 etc etc. This results in the program crashing when counter(my_id+1) is referenced since counter() is set to a size of 4.
Now I know I could change the counter so that its not stored in an array but that would be avoiding the problem that my_id is being changed. Am I doing something wrong with my tags? I thought the format for MPI_SSEND and MPI_RECV was MPI_SSEND (data, number of points, type of data, target node, identifier so as not to get muddled up, status, ierrr).
This has been driving me mad for ages now and I don't know what to do.