[Closed] maxscript & multi threading
Is there any way to get a maxscript to use more than one core when doing intense calculations?
I was pretty sure that was the case. But I thought I’d ask anyway.
Thanks.
sadly
However… depending on just how intense the calculations are, you could – if you’re daring enough – fire up another copy of 3ds Max (perhaps keep it in the background) and set it to work on calculating a portion. You can set the affinity of 3ds Max so that that copy will always use CPU #2 (while the original presumably would use CPU #1 while doing this calculation).
It’d have to be very intense to make it worth it, though, I’d imagine – and would be rather limited to calculations that you can disjoint from the 3ds Max session.
Yeah, already tried the path of multiple max’s open on multi-cored machines. Ram starts being an issue then though. And also have a version that we can use as a pre-render script so it can be sent to the farm. It exports the data to a seprate file for each calculated section so it can then be imported back into one single file after all the seperate calculations are done. It’s some very intense rayMeshGridIntersect calculations.
Thanks,
Cg.
I’m going to stride right into the deep end here … I’ve not tried this, and there is no pure way to do this max script alone (and I don’t have enough knowledge or time about how to do it), but…
If you wanted to give it a try, you could try using .net. It has some classes devoted to multi threading. As to if it can use multiple cores, you’d have to look into it. You’d also need to provide you own assembly to handle the starting and synchronization of the threads as well providing callbacks to maxscript at some later stage…
But there is the only possible solution I can even remotely think of.
But to be quite frank…if Bobo says nope, then I be worried about trying it
Shane
I’ve always thought this feasible with the backgroundworker class, however in this case since since you are using an internal maxscript function – rayMeshGridIntersect, you can’t pass this processing to a dotnet object. Hypothetically, If it was a numerical based formula that you could replicate in dotnet it may be possible. I would write a custom class library in Visual Studio to accept the input and then start the backgroundworker thread class. when it is finished, the thread would return the output. That would keep the max implementation much simpler. Even though i know maxscript a bit more than than VB i have found it easier this way. Again, like shane I am just venturing my 2p’s worth about this. It’s on my todo list when work gets less busy.