04-08-2011 10:55 AM
If you are interpreting "hiding code" as meaning in the current fram but outside th visable area" then that is even worse than what causes us to reject their use (stacked sequences).
Good LV code should be readable "at a glance" and should not require poking at it (to flip through the sequence).
After reading that you shut down hyper-thrading to get in working in earlier version and i sense that you are not excited about re-writing the code to prevent the race conditions (stop breath) then try adding this line to your LV ini file.
ESys.StdNParallel=0
In the more recent version of LV the option to run in a single thread has been removed from the options screen (last I looked anyway). That switch will tell LV to run single threaded.
The purist in me really wants to talk you into re-writing but hey, its not my call.
Ben
04-08-2011 10:56 AM
RE: finding back code in the NI examples
Yes, that is an issue we are working on. eventually we'll get it across to NI as well.
04-08-2011 11:01 AM - edited 04-08-2011 11:02 AM
@lockheed_eng wrote:
smercurio_fc,
thanks for your response.
I am aware that stacked sequences can hide code and we have found hidden code in VIs we have used from other companies (including NI!), but I am 99.9999999% certain (an engineer's 100%!) that there is no hidden code what I've written. I'm pretty meticulous about that kind of thing.
if that's the only concern with stacked sequences then I will continue to use them.
You misunderstood what I meant by "hide code". I meant that you have to go paging around a sequence frame to follow code instead of being able to see it at the same level. I used to use sequence structures. Then I learned how to program better.
local variables, however, I do see where they can cause race conditions with multiple threads - which, as I noted above, we've never had before.
You do not need to be running in multiple threads to have a race condition with local variables. One thread is more than enough to get you in trouble. Don't believe me? Here's proof:
04-08-2011 11:06 AM
Ben,
thank you very much, that may be exactly what I need.
as far as re-writing the code - I would love to! tell me where I can get the budget to do that? I doubt the gov't is interested in funding it.
04-08-2011 11:08 AM
I am a onse n zeros guy. If you want to talk budget, you will have to talk to my boss.
Ben
04-08-2011 11:08 AM
smercurio_fc,
I'm well aware of the problem that using a local variable like your example would cause. on each frame, which to my understanding is supposed to be in "sequence," there are no floating variables like you have in your example. each one is wired to something in each frame, or yes, a race condition will occur.
guys - thanks very much for the advice re: stacked sequences, but I cannot rewrite the code. I barely have budget to get this code to work in LV 10 let alone the hundreds of hours it would take to rewrite. that's just not going to happen.
04-08-2011 12:10 PM
Remember that this wasn't an attempt to beat you over the head about sequence structures. We're just telling you that your reliance on them is indicative of trying to hide a bigger issue. Your question was that your program works in highlight mode, but not at full speed. And as stated, 99% of the time this is due to a race condition. Local variables are the #1 cause of race conditions. Your screenshots showed a very small part of your code, and what we're telling you is that you likely have a race condition. Without seeing the rest of the code you have to find it yourself.
Forcing LabVIEW to run in one thread is a band-aid, at best. To me, it's like Zaphod Beeblebrox putting on those dark sunglasses so he couldn't see danger. I.e., simply avoiding the problem. But, as Ben said, that's your call.
04-08-2011 12:36 PM
thanks for your help.
at first try forcing LV to a single thread did not work. disabling multiple cores and HT in the bios didn't either, but for a different reason - no point in going into that, I put that back.
but I rewrote that particular VI to use flat sequences and now it works. this will probably come up again, tho. thanks again.
04-08-2011 01:02 PM
Hi Reece,
Quick question:
Did you restart LV after adding the ini token?
If you did I would like to know because that could be an indication the switch is working correctly adn I'd to get R&D to look into that if true.
So...
Restarted LV after adding token (T/F) ?
Ben
04-08-2011 01:32 PM
Yes, actually I edited the ini file while LV was closed (that seems almost essential to me). I made a backup of the original, then edited it, saved it then started LV.
but as I said, tho, it didn't really seem to fix my problem, so I'm not sure if it really works or not.