Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Equivalent of omp parallel sections?

davidjward30
Beginner
167 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
Alexey_K_Intel3
Employee
167 Views
5 Replies
RafSchietekat
Black Belt
167 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.

davidjward30
Beginner
167 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.

RafSchietekat
Black Belt
167 Views

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

Alexey_K_Intel3
Employee
168 Views
davidjward30
Beginner
167 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.

Reply