find_first of a vector in parallel in C++

后端 未结 2 850
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 16:06

I have a quite big vector. Some of the vector members are matching a certain condition in parallel. I would like to find the first element matching to the condition.

My p

2条回答
  •  感动是毒
    2021-01-23 16:24

    With OpenMP you can try to build a for loop with #pragma omp for schedule(dynamic). Each thread will execute one iteration in same order as your vector. If you want to check 4 elements by thread, try #pragma omp for schedule(dynamic, 4)

提交回复
热议问题