X___ Posted July 30, 2023 Report Share Posted July 30, 2023 I am not sure whether this has been discussed before, but I stumbled upon a simple (alternative) trick to debug parallelized loops that may be of interests to others. Of course there is always the option to edit the parallelism settings and check the "Allow Debugging" box. The "P" terminal is slightly grayed out and parallelism is turned off until the user changes the settings back to not "Allow Debugging". I find it easy to forget or even fail to notice that a parallelized loop is in "Debug" mode due to the very subtle cue that parallelism is turned off. Generally, it is the degraded performance of the code that will trigger a question and then once is off to a rabbit chase for the culprit... A potentially useful trick is to do what is illustrated below: The code inside the loop is encompassed by a disabled structure (set to "Enabled") and the degree of parallelism set to 1. Note that it is not necessary to edit the Loop Parallelism settings! I find the visual cues much easier to notice (and the code easy to revert to full parallelism). Note that it is possible to use a different P value, but in that case you will miss the majority of loops and the actual loop that will be debugged appears to be somewhat random (I have some idea about which ones are, but this is pure guess). This might fit your needs. Once debugged, it is pretty obvious that the parallel loop is not truly "parallel" anymore, and therefore it is hard to forget to revert to a fully parallelized state. HTH. 1 Quote Link to comment
hooovahh Posted July 31, 2023 Report Share Posted July 31, 2023 First I'll mention that snippets aren't working recently on LAVA. I messaged the admin but haven't heard anything. Second I'm wondering why this can't be a native LabVIEW feature. Has anyone made an idea on the Idea Exchange for probes to work on parallel For loops, where the P terminals can constant fold to a 1? I'm also not sure why this works only in the enabled structure. I wouldn't expect the structure to be a non-reentrant type function. And it doesn't, when I put a wait in there as a test. Quote Link to comment
LogMAN Posted July 31, 2023 Report Share Posted July 31, 2023 31 minutes ago, hooovahh said: I'm also not sure why this works only in the enabled structure. I wouldn't expect the structure to be a non-reentrant type function. And it doesn't, when I put a wait in there as a test. Probes on the top-level diagram of the parallel For Loop simply show no debug info unless debugging is enabled. Any subdiagram will do the trick. Quote Link to comment
X___ Posted July 31, 2023 Author Report Share Posted July 31, 2023 7 hours ago, hooovahh said: First I'll mention that snippets aren't working recently on LAVA. I messaged the admin but haven't heard anything. Second I'm wondering why this can't be a native LabVIEW feature. Has anyone made an idea on the Idea Exchange for probes to work on parallel For loops, where the P terminals can constant fold to a 1? I'm also not sure why this works only in the enabled structure. I wouldn't expect the structure to be a non-reentrant type function. And it doesn't, when I put a wait in there as a test. Hopefully the diagram is simple enough to reproduce... The parallelization options have a maximum number of 16 parallel loops, but this doesn't really play a role in this discussion. As far as "native function", it is native in the sense that you can enable debugging. The only catch is that it is fairly subtle to see that this is enabled (the P terminal is lightly grayed out). It might be a simple matter of enhancing the visual feedback of this option: maybe draw a red cross on the "P"? Quote Link to comment
X___ Posted July 31, 2023 Author Report Share Posted July 31, 2023 6 hours ago, LogMAN said: Probes on the top-level diagram of the parallel For Loop simply show no debug info unless debugging is enabled. Any subdiagram will do the trick. Nice catch on the type specialization structure (or other structures). Obviously I discovered this playing around with a disable structure and did not bother investigating further. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.