multithreaded scripting approach
#1
Hey there
How to script with multithreaded approach. I mean what to define in StartInx, EndInx and ThreadInx
I have already created the effect with script op, but now i want to multithread it.
Can you guide me a little....

What I have done is i have move particle parallel to the object surface in one axis by cross product objnormal and custom point3

but it very slow...
how shall i do the same thing with multithread on



Thank you
Nayan Bodawala
  Reply
#2
Call tf.SetThreaded as instructed in the Script operator comments, and then just change your for loop to use startInx/endInx instead of iterating over the whole particle array.

So instead of:

Code:
for (int i = 0; i < eventParticleCount; i++)

you'd use:

Code:
for (int i = startInx; i < endInx; i++)

The threadInx variable is just there for convenience, if you need to track which thread is being used for a particular chunk of particles being evaluated.
  Reply
#3
(11-06-2019, 10:55 AM)tyFlow Wrote: Call tf.SetThreaded as instructed in the Script operator comments, and then just change your for loop to use startInx/endInx instead of iterating over the whole particle array.

So instead of:

Code:
for (int i = 0; i < eventParticleCount; i++)

you'd use:

Code:
for (int i = startInx; i < endInx; i++)

The threadInx variable is just there for convenience, if you need to track which thread is being used for a particular chunk of particles being evaluated.

THANK YOU VERY MUCH
  Reply


Forum Jump: