Multithreading in Rhino C++ plug-in?

Hello,

I need to speed up an embarrassingly parallel chunk of computations within a C++ plug-in. Is it possible to use a multithreading library like TBB with the Rhino SDK?
Note that within the parallelized code there are no Rhino geometries being instantiated.

I’ve seen this is available in C# through Task Parallel Library, but not sure about C++.

Pablo

I have no experience with TBB, but OpenMP works.

If you are using C++11 >= you don’t have to rely on libraries, check this out: https://www.geeksforgeeks.org/multithreading-in-cpp/
But I don’t have any experience with the Rhino C++ SDK so I am completely ignorant on how to go about this one though.

You can use std::thread in Rhino C++ plug-ins.

– Dale

If you ever want or need to use boost::thread with a Rhino C++ plug-in, you need to include this header

#include <boost/thread/win32/mfc_thread_init.hpp>

Many thanks!

Pablo

If you are doing algorithms that can be parallelized, why not look into OpenCL, I am a CUDA guy myself but I guess you wouldn’t wan’t to loose all the AMD users. I guess you could also use Compute Shaders from OpenGL but you would also loose audience as they are only supported from version >= 4.3

I’ll certainly take a look into it when I find the time. Though my CUDA knowledge from college is completely rusty right now :sweat_smile: