gcc/tests/smoke-test/omphello.c
DistroBaker 8230ff782d Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/gcc.git#ac8f498836cb54282caf6ee9c6bb0c179029c18c
2021-01-12 08:17:11 +00:00

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;
}