Skip to content
Snippets Groups Projects
threads.c 407 B
Newer Older
Bruce Cowan's avatar
Bruce Cowan committed
#include <stdio.h>

#include <omp.h>

int
main (void)
{
    #pragma omp parallel
    {
        int tid = omp_get_thread_num ();
        printf ("Hello world from thread %d\n", tid);

        #pragma omp master
        {
            int nthreads = omp_get_max_threads ();
            int procs = omp_get_num_procs ();
            printf ("%d threads and %d processors\n", nthreads, procs);
        }
    }
}