--sas

apr22-hello-omp.c

Apr 28th, 2022 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <omp.h>
  3.  
  4. int main() {
  5.     printf("*seq1* The number of procs: %d\n", omp_get_num_procs());
  6.  
  7. #pragma omp parallel num_threads(6)
  8.     {
  9.         printf("*par* Hello OMP! This is thread #%d out of #%d\n", omp_get_thread_num(), omp_get_num_threads());
  10.     }
  11.  
  12.     printf("*seq2* Hello OMP! This is thread #%d out of #%d\n", omp_get_thread_num(), omp_get_num_threads());
  13.  
  14.     return 0;
  15. }
Add Comment
Please, Sign In to add comment