Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <mpi.h>
- int main(int argc, char **argv){
- int myrank;
- int comm_size;
- int table1[] = {1, 2, 3, 4, 5, 6, 7,8, 9, 10};
- int table2[] = {11, 12, 13, 14, 15, 16,17,18,19,20};
- int min = 0;
- int max = 0;
- int i = 0;
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
- MPI_Comm_size(MPI_COMM_WORLD, &comm_size);
- if (myrank == 1){
- max = 0;
- min = 99999;
- for (i = 0; i<10; i++){
- if (max < table1[i]){ max = table1[i];}
- if (min > table1[i]){ min = table1[i];}
- printf("Max: %d, min: %d", max, min);
- }
- }
- MPI_Finalize();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement