LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Again closing references and reentrant vi-calls

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

 

original.jpg

0 Kudos
Message 1 of 10
(3,343 Views)

@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.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,314 Views)

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

0 Kudos
Message 3 of 10
(3,307 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(3,304 Views)

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

0 Kudos
Message 5 of 10
(3,298 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(3,291 Views)

Again about closing references:

Thanks

 

 

CloseReference.jpg

0 Kudos
Message 7 of 10
(3,249 Views)

You are dealing with a static reference, so no.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(3,244 Views)

Is it wrong if i execute CloseReference to the StaticReference?

What are the dynamicReferences that must be closed?

 

Thx

0 Kudos
Message 9 of 10
(3,214 Views)

@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


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(3,205 Views)