Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Equivalent of omp parallel sections?

davidjward30
Beginner
1,224 Views

Hello,

I know that tbb is not supposed to be a direct replacement for openmp, but having dabbled with openmp a little bit I think that in general TBB suits my needs more than openmp so I was planning to use tbb exclusively

However, I'm still unsure how I would effect an omp parallel sections piece of code:

e.g.

#pragma omp parallel sections
{
#pragma omp section
XAXIS();
#pragma omp section
YAXIS();
#pragma omp section
ZAXIS();
}

I would guess that using the task scheduler directly is the way to do it?

Regards,

David.

0 Kudos
1 Solution
5 Replies
RafSchietekat
Valued Contributor III
1,224 Views
"I would guess that using the task scheduler directly is the way to do it?" You could do that. I would go with parallel_for myself.

0 Kudos
davidjward30
Beginner
1,224 Views
Quoting - Raf Schietekat
"I would guess that using the task scheduler directly is the way to do it?" You could do that. I would go with parallel_for myself.

I feel silly for asking, but could you possible give me some (psuedo)-code for the above problem? Thanks.

0 Kudos
RafSchietekat
Valued Contributor III
1,224 Views

Please see the tutorial; in the body, use a switch()on theiteration value.

0 Kudos
Alexey-Kukanov
Employee
1,225 Views
0 Kudos
davidjward30
Beginner
1,224 Views

Thanks for the answers. I must admit the "switch in the body" did occur to me - I just thought it was just a bit too clumsy and assumed I was missing out on something else. I think task groups are probably what I'm seeking.

Cheers.

0 Kudos
Reply