Fakultas Ilmu Komputer UI

Commit fa513508 authored by Ardhi Putra Pratama's avatar Ardhi Putra Pratama
Browse files

fixup! MPI simple send-receive

parent b80ebac2
......@@ -7,7 +7,7 @@ int main(int argc, char **argv) {
int myid, numprocs;
int i, x, low, high, myresult=0, result;
int data[DATASIZE] = {1,2,3,4,5,6,7,8,9,10}
int data[DATASIZE] = {1,2,3,4,5,6,7,8,9,10};
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
......@@ -22,7 +22,7 @@ int main(int argc, char **argv) {
for(i=low; i<high; i++) {
myresult += data[i];
}
printf("%d has %d\n", myresult, myid);
printf("%d has %d\n", myid, myresult);
MPI_Reduce(&myresult, &result, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
......
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