Multithread / Multicore Support
I’ve come to a stumbling point on the latest toolpath updates as I try to come up with a simple way to eliminate some of the unneeded retracting on finish paths. I’ve got a number of ways to approach the problem but none that I believe will work quickly and without a lot of bugs over the following several months. I finally put the problem aside for a few days since I wasn’t making a lot of progress. I decided to try adding multithreading support since I use a dual-core laptop and the new toolpath engine that was introduced over the last year is well suited to parallelism (I planned ahead for a change).
I was able to get one simple function multithreaded within a few hours with good results. Tonight I was able to enable it for the “Offsetting Surface” step that occurs for waterline, pencil, and parallel finishing with a threshold angle. I was able to complete the step in almost half the time as one core alone- really good considering this is nearly the theoretical maximum for a dual-core machine. Users with a quad-core machine should see an even better improvement.
Needless to say I’m very happy about this. Multithreading in the core algorithms should be a big step forward since, from what I can tell, most competitors do not do it. The roadmaps and predictions from Intel and AMD indicate that this type of optimization will be more important in the coming years as more cores are added to offset the lack of potential for new clock speed improvements. The geeks in the crowd can read more here, http://www.gotw.ca/publications/concurrency-ddj.htm . The truly geeky will already have read it.
As luck would have it I came up with a solution to the retract problem about an hour after giving up. Now I just have to write the code.
Comments
8 Responses to “Multithread / Multicore Support”


I’m really glad to hear you’re addressing this.
Question: So if I understand correctly, the newer version of MC should work with my 1.6Ghz P4 single core with 992MB RAM? I plan to buy a new PC soon but don’t have it yet and things can come up that push getting it down the priority list. Improving the retracing issue is important to me since I do a lot of projects that are fairly large format and can get quite time consuming under the current version of MC I’m using. So hopefully you can find a way to accomplish both reducing retracing while utilizing mimimum possible system resources.
None of the changes should hurt on single core machine but just about any new or recent machine should benefit a lot.
The retract code is more important overall and is top priority- it’s just a matter of moving on to a different task for a while when you hit a wall so you don’t waste time.
The other benefit is that speeding up calculations through multithreading lets me do more of them to generate higher quality toolpaths.
-Robert
So does this mean we should see an improvment on multithread single core processors Robert, or is that a different thing? Most of the computers you look at now are multicore so this will is an improtant feature for the future anyway.
I’ll just struggle on with my single core slow computer it’s funny as it’s quite quick and most projects are done in 10 minutes or so anyway but you always want more and faster don’t you?
Steve
I expect that you will not see a significant improvement on single core CPU with hyperthreading. The performance on a dual-core seems to double relative to a single-core so I the algorithms are probably limited by CPU performance rather than other parts of the system like the disks, etc, where the hyperthreading may be a benefit. I expected this before I began but I was still glad to see that it was the case.
You’ve got more patience than me- my of my paths are calculated in under 1-2 minutes on my year-old laptop before this upgrade. I don’t think I could wait 10 minutes.
-Robert
I guess I have more patience too. 10 minutes is not all that uncommon here even with a memory stuffed fast desktop. But it is a dual core so maybe the number of coffee breaks will go down… or more probably I’ll just make more complex models.
I see that it only took you 5 days to go from a 50% speed improvement to thinking about more calculations.
Jeff
Just think about how much better the toolpaths will be though…
Cake and ice dream at the same time !!!
Jeff
Mmm.. I think I pinch my sons new duel core desktop
Steve