- if (0 == rank) {
- value = 17;
- }
- status = MPI_Bcast(&value, 1, MPI_INT, 0, MPI_COMM_WORLD);
- printf("node %d has value %d after broadcast\n", rank, value);
+ for (i = 0; i < count; i++)
+ values[i] = (0 == rank) ? 17 : 3;
+
+ status = MPI_Bcast(values, count, MPI_INT, 0, MPI_COMM_WORLD);
+
+ int good = 0;
+ for (i = 0; i < count; i++)
+ if (values[i]==17) good++;
+ printf("[%d] number of values equals to 17: %d\n", rank, good);