omp_get_thread_num()
: Thread ID [Master thread has id == 0
]
#pragma omp parallel
: a parallel region is marked in a scope
#pragma omp parallel shared() private()
{
#pragma omp for schedule (static chunksize)
for (/* */) {
}
}
chunksize
#pragma omp parallel
{
#pragma omp sections
{
#pragma omp section
{
work1();
}
#pragma omp section
{
work2();
}
#pragma omp master
{
master();
}
}
}
master
construct for only the master section#pragma omp parallel
{
#pragma omp critical
{
// critical section
}
#pragma omp atomic
// atomic statement (the atomic operation on the storage location
// designated as x is a unit of work)
}