Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit fa513508 authored by Ardhi Putra Pratama's avatar Ardhi Putra Pratama
Browse files

fixup! MPI simple send-receive

parent b80ebac2
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment