parallel sections Directive
- 업데이트 날짜:2023-02-21
- 1분 (읽기 시간)
Specifies a parallel region containing one sections directive. The parallel sections directive is a shortcut for the parallel directive followed immediately by a sections directive. The shortcut creates a team of threads and divides the sections between the threads at the same time.
Binding thread set: encountering thread
Format
#pragma omp parallel sections [clause[ [,]clause] ..] newline
{
#pragma omp section
{
code block
}
}
Example
int main()
{
#pragma omp parallel sections
{
#pragma omp section
printf("This is from thread %d\n", omp_get_thread_num());
#pragma omp section
printf("This is from thread %d\n", omp_get_thread_num());
}
}