Guest User

Untitled

a guest
Jan 12th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <omp.h>
  2. #include <stdio.h>
  3.  
  4. int main (int argc, char *argv[]) {
  5. int th_id, nthreads;
  6.  
  7. #pragma omp parallel private(th_id)
  8. {
  9. th_id = omp_get_thread_num();
  10. printf("Hello World from thread %d\n", th_id);
  11. #pragma omp barrier
  12. if ( th_id == 0 ) {
  13. nthreads = omp_get_num_threads();
  14. printf("There are %d threads\n",nthreads);
  15. }
  16. }
  17.  
  18. return 0;
  19. }
Add Comment
Please, Sign In to add comment