09-08-2014 04:24 AM
Hello,
i create a static-vi-reference that is then opened in a loop for 10 times in parallel. At the end i wait for all are finished. Then i close the reference that was created from "Open Vi reference".
Question 1: Do i also have to close the reference that is coming from "Static vi reference"?
(This 10x opening happens each second).
Question 2:
Currently the vi that is used as static vi-reference is set in VI-Poperties + Execution to "Shared clone reentrant execution".
What about all the subvis that are called in there? Do i also have to set them to "Shared clone reentrant execution" or is this done automatically?
Question 3:
I have the effect that everything seems to run fine but the CPU and memory increases
After starting the program 50 MB RAM and CPU at 15%
Then i can be seen that there are cpu-peaks from time to time, Seems as this are the parallel-calls.
Then cpu goes higher and higher up to 72% and ram goes to 230MB (after 4 hours)
Is ther something that can be changed in this mimic? There is nothing else running that can eat my cpu und ram.
Thx
09-08-2014 07:16 AM
@OnlyOne wrote:
Question 1: Do i also have to close the reference that is coming from "Static vi reference"?
(This 10x opening happens each second).
No
Question 2:
Currently the vi that is used as static vi-reference is set in VI-Poperties + Execution to "Shared clone reentrant execution".
What about all the subvis that are called in there? Do i also have to set them to "Shared clone reentrant execution" or is this done automatically?
They are not changed automatically. If you want everything inside of that VI to run COMPLETELY independent, then you need to set the reentrancy for all of those VIs. If you want them to share information, then non-reentrant VIs is a good way to do that. So it all depends on what you want the individual subVIs to do.
Question 3:
I have the effect that everything seems to run fine but the CPU and memory increases
After starting the program 50 MB RAM and CPU at 15%
Then i can be seen that there are cpu-peaks from time to time, Seems as this are the parallel-calls.
Then cpu goes higher and higher up to 72% and ram goes to 230MB (after 4 hours)
Is ther something that can be changed in this mimic? There is nothing else running that can eat my cpu und ram.
I'd have to see what else is happening inside of your code. This could be any number of things, usually having to do with building arrays.
09-08-2014 07:42 AM
Question 2:
Do i understand it correct that if i open 10 times a reentrant vi where the containing sub-vi is NOT set as reentrant then the vis will execute sequential and each reentrant vi will have to wait fo execution until the sub-vi is free?
For example:
- open in a loop 10 times: reentrant.vi (which is set to reentrant)
- reentrant.vi contains one vi "mysub.vi" (which is not set to reentrant)
So if mysub.vi takes 1 sec to execute then the loop will take 10secs
If mysub. would be also set to reentrant then loop takes 1sec.
Is this correct?
I dont need pass any values between the reeantrant vis.
Question 3:
Perhaps you found the point. I am doing everything over global arrays. The instrument-adressing, the instrument-configuration, the measurements...
What can go wrong in here?
Thx
09-08-2014 07:47 AM
@OnlyOne wrote:
Question 2:
Do i understand it correct that if i open 10 times a reentrant vi where the containing sub-vi is NOT set as reentrant then the vis will execute sequential and each reentrant vi will have to wait fo execution until the sub-vi is free?
For example:
- open in a loop 10 times: reentrant.vi (which is set to reentrant)
- reentrant.vi contains one vi "mysub.vi" (which is not set to reentrant)
So if mysub.vi takes 1 sec to execute then the loop will take 10secs
If mysub. would be also set to reentrant then loop takes 1sec.
Is this correct?
That is how it will work. Each of your reentrant VI instances will run until that subVI is called. If it is already called somewhere else, then the instances must wait until the subVI becomes available. So assuming instance 1 gets there first, instances 2 through 10 will run until calling that subVI and then it is a first come first serve of who will get to run it next.
If you are dealing with instrument communication, you will have this problem anyways, so it doesn't really help anything to have those VIs be reentrant.
09-08-2014 08:02 AM
Yes i am doing instrument-communication.
You mean this because the VISA write/read will not run reentrant?
What about the global-variables? They dont have a reentrant-option. Is this also a "wait"-thing then?
(Each reentrant-vi reads a different index from a global-variable. The index is passed to the reentrant-vi.
Thx
09-08-2014 08:49 AM
Globals are so fast, I would not be worried about those.
But instrument communication is always an issue when it comes to parallel operations. Especially if they are all on the same bus. Only one instrument can be talking at a time on a bus. That is just the way it is.
09-10-2014 09:38 AM
Again about closing references:
Thanks
09-10-2014 09:43 AM
You are dealing with a static reference, so no.
09-11-2014 02:28 AM
Is it wrong if i execute CloseReference to the StaticReference?
What are the dynamicReferences that must be closed?
Thx
09-11-2014
06:28 AM
- last edited on
08-12-2024
11:21 AM
by
Content Cleaner
@OnlyOne wrote:
Is it wrong if i execute CloseReference to the StaticReference?
What are the dynamicReferences that must be closed?
Thx
Didn't I already give you this link? Closing References in LabVIEW