Ask Your Question

Revision history [back]

I don't think it's a good idea to have one thread per pixel on the CPU. You should create some image blocks (with overlapping) and use a loop inside each tile. Therefore, it's easy to manage the dependency. Usually a number of threads equal to the number of cores is a good choice, but depending on your computation a higher/smaller number of threads could be better. It's a trial and error process... And you still can use parallel_for_ without the dependency issue.