B9 - single, master and masked directives

single directive

#pragma omp parallel
{
    #pragma omp single
    {
        printf("Hello from thread %d\n",
               omp_get_thread_num());
    }
}

master and masked directives

#pragma omp parallel
{
    #pragma omp single
    {
        printf("Any one thread executes this\n");
    }

    #pragma omp masked
    {
        printf("Thread 0 executes this\n");
    }
}
#pragma omp parallel num_threads(4)
{
    #pragma omp masked filter(2)
    {
        printf("Thread %d\n", omp_get_thread_num());
    }
}

>>> Thread 2