25 lines
406 B
C
25 lines
406 B
C
#include <omp.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int th_id;
|
|
int nthreads;
|
|
|
|
#pragma omp parallel private(th_id)
|
|
{
|
|
th_id = omp_get_thread_num ();
|
|
printf ("Hello World from thread %d\n", th_id);
|
|
|
|
#pragma omp barrier
|
|
if (th_id == 0)
|
|
{
|
|
nthreads = omp_get_num_threads ();
|
|
printf ("There are %d threads\n", nthreads);
|
|
}
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|