4 ms·
> you could write your own scheduler or use a library I never wrote ray tracers, but in my experience the best way to parallelize things is usually “none of th
by Const-me 5y ago
> you could write your own scheduler or use a library
I never wrote ray tracers, but in my experience the best way to parallelize things is usually “none of the above”.
C++ runtime has a built-in scheduler, OpenMP https://www.openmp.org/ https://www.openmp.org/ If the algorithm needs to dynamically spawn tasks (graph search, flood fill or similar), Windows kernel has another one, see SubmitThreadpoolWork API.
These things tend to work better than third-party libraries, and are way easier to consume than developing custom schedulers.
- chrisseaton 5y ago> C++ runtime has a built-in scheduler, OpenMP Is OpenMP part of the C++ standard these days?
- d110af5ccf 5y agoI don't think so. I believe OpenMP qualifies as a (very mature and widely supported) library as well as language extension. Assuming it meets your needs it has (AFAIK) support from all the major compilers (Intel, MS, GCC, LLVM) as well as being able to abstract over GPUs and other sorts of hardware.
- Const-me 5y agoNo, but it’s supported by all modern compilers. In practice, that’s almost as good as being a part of the language standard. The level of support varies, but OpenMP 2.0 standard is supported by all 4 of them.
- pjmlp 5y agoThere are a few more than 4.
- Const-me 5y agoTechnically, sure. But practically — what’s your estimation how many C++ programmers target anything besides these 4, gcc, clang, vc++ or intel? My estimation is [ 0.1% .. 1% ]
- pjmlp 5y agoPlenty, for example HPC tends to favour IBM's XL compilers. Embedded tends to have their own vendor forks, even if based on GCC/clang, it isn't the same thing. Then we have game consoles as well.
- maccard 5y agoIntel TBB has a steep initial learning curve, but is incredible once you've passed that initial hump. If I was working on a greenfield project, I woudl start with TBB.