How does the SECTIONS directive in OpenMP distribute work?

前端 未结 8 750
情话喂你
情话喂你 2020-11-29 08:14

In OpenMP when using omp sections, will the threads be distributed to the blocks inside the sections, or will each thread be assigned to each sections?

8条回答
  •  眼角桃花
    2020-11-29 08:26

    Change the first line from

    #pragma omp sections

    into

    #pragma omp parallel sections

    "parallel" directive ensures that the two sections are assigned to two threads. Then, you will receive the following output id = 0, id = 1,

提交回复
热议问题