I am working on converting an existing program to use some parallel STL functions.
In particular, I rewrote a large loop to work with std :: accumulate. It works beautifully.
Now I want this accumulation operation to be performed in parallel.
The documentation I saw for GCC describes two specific steps.
- Enable compiler flag
-D_GLIBCXX_PARALLEL - It is possible to add the header
<parallel/algorithm>
Adding a compiler flag does not change anything. The runtime is the same, and I see no signs of using multiple cores in monitoring the system.
I get an error when adding the parallel / algorithm header. I thought it would be included in the latest version of gcc (4.7).
So a few questions:
- Is there any way to finally determine if the code works in parallel?
- Is there a โbest practiceโ way to do this on OS X? (Ideal compiler flags, header, etc.?)
Any suggestions are welcome.
Thanks!
Noah
source share