06-09-2005 01:14 PM
06-09-2005 02:03 PM
06-09-2005 02:14 PM - edited 06-09-2005 02:14 PM
@Ken Pietrzak wrote:
In the process of making some of our VIs reentrant, we discovered that most of the VIs in vi.lib are not reentrant. For example, mean.vi and it seems that all of the other analysis VIs are not reentrant. Is there a reason for this? Would there be any harm in making these VIs reentrant?
Message Edited by rolfk on 06-09-2005 02:15 PM
06-10-2005 08:29 AM
06-10-2005 11:03 AM
@Ed Dickens wrote:
If you see a need or want to change a vi.lib VI, always save it elsewhere (user.lib) with a different name. Thias way you won't break anything that depends on the original VI.
06-10-2005 04:03 PM
04-13-2006 10:05 AM - edited 04-13-2006 10:05 AM
A better approach to calculate the mean in LabVIEW itself would be to use Add Array Elements and dividing the result by N. This sure enough should be about as fast as any C code you can come up with.
@Ken Pietrzak wrote:
Thanks folks for your responses. We generally use multiprocessor computers for our applications. We want to be able to run several processes in parallel to make use of those processors. I assumed that making any common subvi calls from parallel processes reentrant that execution time would drop since these subvis would be run in parallel especially when cranking on large amounts of data. So I also would have expected that NI VIs in vi.lib would be reentrant by default. I guess I was wrong. I did not realize the overhead in creating multiple instances of these VIs would outweigh the gain from parallelism. To verify what you folks were saying, I copied the mean.vi, made it reentrant, and placed it in parallel loops. I was surprised to find out that no matter how large the array size or how many loop iterations I used, the non-reentrant version of mean.vi was always faster than the reentrant version. So I guess we need to really think about which subvis to make reentrant in our code.
I also tried replacing mean.vi in each loop with my own code (just summing off a shift register in a loop and dividing by N after the loop) and found that to be exceedingly slow. It's got me thinking now that I may need to convert some of our processing intensive image processing code to C to be called by a dll from LabVIEW to speed execution of that code.
Message Edited by rolfk on 04-13-2006 05:05 PM
01-14-2008 01:33 PM
01-14-2008 03:21 PM
LabVIEw 8.5 has a new setting for reentrant VIs called "Share clones between instances". It is a middle thing between non-reentrant and reentrant and should suffice for most cases but uses less resources than reentrant. But unless you really really have multiple processors and are very cautios how you program your code, you won't see much of a speed improvement even with fully reentrant subVIs.
@Phamton wrote:
I'm running into a similar issue as Ken. There are several library VIs I use in data processing (1D polynomial evaluation, for example, to convert from binary to scaled data) that I would like to use in parallel to take advantage of multiple processors. If I make a copy of the library VI, make my copy reentrant, then run it in parallel paths everything should be all right? (i.e. is it safe to change the library VIs to reentrant?)
01-14-2008 04:31 PM