04-07-2015 08:26 PM
This is simple parallel loop to process mean value of each waveform.
When using Tools->Profile->Find Parallelizable Loops, it says:
This For Loop may or may not be safe to parallelize. Warning(s):
- One or more nodes in the For Loop may have side effects.
So why? Is it non-reentrant?
Solved! Go to Solution.
04-07-2015 08:42 PM
"May not be safe" does not mean it is unsafe. I think it is safe to parallelize.
04-07-2015 08:55 PM
The Mean function calls an internal NI function, which may (or may not/ be reentrant. You can always code up your own Mean code easily enough, and could make it reentrant -- that would probably fix your problem.
Bob Schor
04-07-2015 09:05 PM
How about built in filter pallattes? Unlikely to be written by myself.
It also has warning for the side effect. It seems like the Labview profiler has no knowlege whether an internal NI function is reentrant or not.
Is it?
04-07-2015 10:16 PM
04-07-2015 10:57 PM
Well, it is inlined and reentrant, and the compiler knows that. 🙂
Are you pressed for performance? How big are the waveforms? You might want to benchmark with/without parallelization to see if the parallelization overhead is actually worth it.
04-08-2015 07:06 AM - edited 04-08-2015 07:08 AM
I think it is the DLL call that the tool is worried about. Not many DLLs out there are actually thread safe.
EDIT: Just looks at the Mean.vi function. It is NOT reentrant. Therefore you really could not run many of these in parallel.
04-08-2015 08:48 AM
Well, the diagram shown here is just to simplify my question.
In fact, my concern is how far I can rely on the Labview profiler to tell me a parallelism is safe (or worked) or not.
It seems like conclusion from you guys is warning is the best advice that the profiler can give for those pre-compiled functions.
No direct way (maybe?) to figure out whether they are re-entrant / thread-safe.
Think so.
04-08-2015 09:35 AM
hongcc1 wrote:
It seems like conclusion from you guys is warning is the best advice that the profiler can give for those pre-compiled functions.
No direct way (maybe?) to figure out whether they are re-entrant / thread-safe.
DLLs, not really. VIs, open them up and look at the VI Properties->Execution.
04-08-2015 10:32 AM
crossrulz wrote:EDIT: Just looks at the Mean.vi function. It is NOT reentrant. Therefore you really could not run many of these in parallel.
What LabVIEW version are you using? I checked in both 2013SP1 and 2014SP1 and mean.vi is [reentrant, preallocate clone, inlined]. Seems absolutely safe to parallelize.