04-28-2009 04:20 PM
I am trying to write code to spawn multiple instances of the same re-entrant VI, called calculate. The calculate takes as inputs:
Queue Reference - this is how the data is passed to the vi.
Operation - the VI can calculate different operations (say std, var, etc)
Start Index - the start of the calculation index on the data array
Stop Index - the stop of the calculation index on the data array.
The main VI would spawn N copies of the VI and then pass data to the SubVI. It would seem that if I truly wanted the VI's to run in parallel I would need to be able to set the thread and execuation system that it runs in. Can this be done with VIServer? Don't VIServer VI's run out of process, and if so how do you control what thread they run in? Do they automatically run in a new thread in a new process?
Anyone tried anything like this?
Thanks for looking.
04-28-2009 05:48 PM
The preferred execution system of a VI can be set using the Execution:Preferred Exec System property for a VI reference.
Based on your description it doesn't sounds like you actually need reentrancy, but rather a template VI.
04-29-2009 10:56 AM
Hey Rammer,
Check out this thread on creating the vi template and calling it dynamically in its own thread.
Hope this helps
-Ben
04-29-2009 11:32 AM
Isn't reentrancy needed because I am going to have the same VI running multiple times in separate loops/instances?
Rammer
04-29-2009 11:41 AM
Ben,
Based on that thread:
1. All VI's launched via VIServer are in a their own thread - has anyone ever verified this? Does it ignore the execution properties of the VI?
2. What is AE referring to?
John
04-29-2009 01:39 PM
rammer wrote:Isn't reentrancy needed because I am going to have the same VI running multiple times in separate loops/instances?
It depends on whether you're calling the subVI statically or dynamically and whether you're trying to do this in a loop, or you simply have multiple instances of the subVI on a block diagram:
See the attached example for a few scenarios.
P.S. AE = Action Engine.