tyFlow Forum
multithreaded scripting approach - Printable Version

+- tyFlow Forum (https://forum.tyflow.com)
+-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html)
+--- Forum: Bugs and Issues (https://forum.tyflow.com/forum-3.html)
+--- Thread: multithreaded scripting approach (/thread-1263.html)



multithreaded scripting approach - nayan - 11-06-2019

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


RE: multithreaded scripting approach - tyFlow - 11-06-2019

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.


RE: multithreaded scripting approach - nayan - 11-06-2019

(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