Hi Steve, thanks for the explanation. Intuitively I would have imagined that it works exactly the other way round.
Solving once -> multi threaded, dealing with the threads internally
Solving multiple times -> not multi threaded.
Ideally, both cases should be multi threaded, if possible.
@stevebaer Regarding the contour component, I tried to reproduce what @Angel is reporting, but was not able to. With the second example, I get to around 25% CPU usage today. There is some multi threading happening, but not as much as in the first example, where I get 80% CPU usage.
@Angel, the 12.5 CPU usage hints at one core being used only. I am having 8 cores, so 100% / 8 = 12.5%. Maybe your Xeon has four cores?
We use similar method in RAPCAMās v5 Rhino grasshopper for Internet based validations and some intense calculations, which donāt block UI interactions while calculations are performed in parallel tasks. This works quite nicely.
Thanks for the post. We were able to make everything much simpler by adjusting Grasshopper to call SolveInstance in two passes when your component implements the new IGH_TaskCapableComponent interface (and the option is enabled for your component).
The first pass is used to build a calculation task for every iteration. Each iteration could launch further sub-tasks if it makes sense.
The second pass gets results from these tasks and sets IGH_DataAccess output
This makes every iteration potentially computed in a separate task and the output data structure is exactly the same without any extra effort.
That sounds amazing, really looking forward, this will be a great improvement for larger computations and general UX of gh. I will start migration from v5 to v6 asap just for this
Please hold off on migrating based on the document I provided. I think there are a few changes I want to make in the base class that will simplify the code a little more. Iāve updated a few more components this week and there is a bit of unnecessary repetition that I think I can remove.
It would be nice, but I wonāt be able to make that change for the āBoundary Surfacesā component. This component works on a single large collection of curves and tries to figure what to do for all of these curves at once. Consider the case of a small circle inside of a larger circle. The interdependencies of these curves in the calculation makes multi-threading at the lower level difficult.
Fortunately, the story will be different for others components.
The Sept 5, 2017 WIP now includes an additional 10 components that use multiple threads to solve. Here are the additional components that could use some ākicking of the tiresā for multi-threaded solving.
This was actually available in last weekās WIP, but I forgot to mention it. David and I added converted another set of components to be able to use multiple threads for solving. The current list is:
Iām having some problems trying to use the Parallel option for the BREP | Line and BREP | Curve components ā¦ basically Rhino āstops workingā using either of them, but running single-threaded works. Calculation is ~6.4M lines intersecting a BREP ā¦ although iād like to actually check the 16 individual faces of the BREP, but first things first ā¦
Related - is there any chance Mesh | Ray could be next on the list of threaded components? In the same script Iām currently testing 2818 rays from 4771 points for intersection with a (rather large) mesh - the ~13.4m tests take ~4 minutes so iād like to get this multi-threaded
@DavidRutten would it be possible to parallelize the Surface Geodesic component? This is a computationally heavy component which I suspect could be easily parallelized. While youāre at it, Iām wondering if you can expose the tolerance value in the component?
Surface Split is another component which could be parallelized and is often computationally expensive.