Changed all INT constants to DOUBLE.

parent 0cf49f2e
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
// Send it to each rank // Send it to each rank
MPI_Send(work, // message buffer MPI_Send(work, // message buffer
items_per_task, // size of data array items_per_task, // size of data array
MPI_INT, // data item is an integer MPI_DOUBLE, // data item is an integer
rank, // destination process rank rank, // destination process rank
WORK_TAG, // user chosen message tag WORK_TAG, // user chosen message tag
MPI_COMM_WORLD); // default communicator MPI_COMM_WORLD); // default communicator
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
// Send the slave a new work unit // Send the slave a new work unit
MPI_Send(work, // message buffer MPI_Send(work, // message buffer
items_per_task, // size of data array items_per_task, // size of data array
MPI_INT, // data item is an integer MPI_DOUBLE, // data item is an integer
status.MPI_SOURCE, // to who we just received from status.MPI_SOURCE, // to who we just received from
WORK_TAG, // user chosen message tag WORK_TAG, // user chosen message tag
MPI_COMM_WORLD); // default communicator MPI_COMM_WORLD); // default communicator
...@@ -60,6 +60,6 @@ ...@@ -60,6 +60,6 @@
void master_destroy(int ntasks) { void master_destroy(int ntasks) {
// Tell all slaves to exit by sending an empty message with the DIE_TAG. // Tell all slaves to exit by sending an empty message with the DIE_TAG.
for (int rank = 1; rank < ntasks; ++rank) { for (int rank = 1; rank < ntasks; ++rank) {
MPI_Send(0, 0, MPI_INT, rank, DIE_TAG, MPI_COMM_WORLD); MPI_Send(0, 0, MPI_DOUBLE, rank, DIE_TAG, MPI_COMM_WORLD);
} }
} }
...@@ -8,7 +8,7 @@ void slave(int items_per_task) { ...@@ -8,7 +8,7 @@ void slave(int items_per_task) {
MPI_Status status; MPI_Status status;
/* Receive a message from the master */ /* Receive a message from the master */
MPI_Recv(&work, items_per_task, MPI_INT, 0, MPI_ANY_TAG, MPI_Recv(&work, items_per_task, MPI_DOUBLE, 0, MPI_ANY_TAG,
MPI_COMM_WORLD, &status); MPI_COMM_WORLD, &status);
/* Check the tag of the received message. */ /* Check the tag of the received message. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment