11-01-2019 05:25 AM
I'm having trouble executing 3 instances of a program, lets call it crunch.exe. The intention is to feed data sets to the 3 instances and for them to run in parallel. When finished, each loop should obtain another work package from the queue and invoke crunch.exe again. This should continue until all the datasets have been processed by the 3 instances. See the block diagram below.
To explain what actually happens, lets assume that dataset 1 takes 10 seconds, dataset 2 takes 20 seconds and dataset 3 takes 30 seconds. Whilst monitoring Taskmanager:
So each time around the loop, the loop pauses after processing its dataset until its 2 sibling loops have completed processing their datasets. I've tried placing the Cmd action into a re-entrant subvi but the behavour is the same. I've also tried putting the subvi into a different Preferred Execution System with differrent (higher) priorities to the main vi but again the behaviour is the same.
I'm running labview 14 on windows 10 pro. The PC has 2 physical cpus, each with 6 physical cores and hyperthreading is enabled. There is 96Gbytes of ram available.
Can any one help (please!).
Ian
Solved! Go to Solution.
11-01-2019 06:41 AM
It is sounding like your crunch.exe is not "thread safe". In other words, it doesn't like to run things in parallel. A stupid experiment to try would be to make 2 copies of the executable and have each of your loops call a different copy.
11-01-2019 08:56 AM
If it takes 30 seconds to execute three datasets, then they execute in parallel. Otherwise they would execute 20+30+10 seconds.
I would say it is system exec problem waiting for all instances of one executable
macsmithAgain, Can you try to start 3 cmd sessions in windows and send each command there?
11-01-2019 09:18 AM
thanks crossrulz, an interesting thought. I did as you said and created crunch0.exe, crunch1.exe and crunch2.exe, calling them instead of crunch.exe. Sadly the result was the same. 😞
11-01-2019 09:22 AM
thanks Alexander_Sobolev. I too think it's something to do with the System Exec but have been unable to find out and whatever it is.
Re the anticipated runtimes, what should happen is that after 10 seconds, the first completing thread should pickup another dataset off of the queue and start running that immediately. Instead it waits until the other two have finished (30 secs) before running again. So it is running in parrallel but for some reason, awaiting the completion of the other two before doing the next job.
11-01-2019 09:26 AM
Whatever it is that "Crunch" is doing, could you do it with LabVIEW code? Then you could make it a VI, set it to be a Pre-allocated Reentrant Clone, and call as many copies as you wanted (or would fit), letting LabVIEW ensure the parallelism for you.
Bob Schor
11-01-2019 09:53 AM - edited 11-01-2019 09:55 AM
I've also just tried running three CMD consols simultaneously and they complete in the correct amount of time, ie, they don't wait on the other two.
So perhaps it's labview's implementation of CMD.
Ian
11-01-2019 09:55 AM
crunch (not its real name) is actually a commercial product, so I can't replicate it in labview, unfortunately.
Ian
11-01-2019 11:30 AM
11-01-2019 11:40 AM - edited 11-01-2019 11:41 AM
A somewhat closer test also doesn't show the problem you describe (at least for me).
So perhaps the problem is related to crunch.exe? (or at least, "timeout" behaves as expected).
The attached file is backsaved to 2015 - I've not checked what happened to the Sync Data Flow VIM...