Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <string.h>
  5. #include <time.h>
  6. #include <unistd.h>
  7. #include <mpi.h>
  8. #include <omp.h>
  9.  
  10. int rank, proc_num;
  11.  
  12. int main(int argc, char **argv)
  13. {
  14.     int error = MPI_Init(&argc, &argv);
  15.     if (error != MPI_SUCCESS) {
  16.         fprintf (stderr, "MPI_Init error \n");
  17.         return 1;
  18.     }
  19.     MPI_Comm_size(MPI_COMM_WORLD, &proc_num);
  20.     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  21.     printf("%d / %d\n", rank, proc_num);
  22. #pragma omp parallel
  23. {
  24.     printf("%d / %d: %d\n", rank, proc_num, omp_get_num_threads());
  25. }
  26.     MPI_Finalize();
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement