Why is OpenMP outperforming threads?

后端 未结 2 1716
余生分开走
余生分开走 2020-12-19 16:59

I\'ve been calling this in OpenMP

#pragma omp parallel for num_threads(totalThreads)
for(unsigned i=0; i

        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 17:22

    Where does totalThreads come from in your OpenMP version? I bet it's not startIndex.size().

    The OpenMP version queues the requests onto totalThreads worker threads. It looks like the C++11 version creates, startIndex.size() threads, which involves a ridiculous amount of overhead if that's a big number.

提交回复
热议问题