LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not configure for loop for parallelism

Hello all,

 

I have a loop that I would like to configure to operate in parallel, a loop which has been identified as "possibly not parallelizable" - even though there are not interdependencies, I am indexing on the bounds of the array.  The problem comes when I actually try to parallelize the loops and then save - Labview dies everytime and has to be restarted.  Has anyone else seen this? I am using LV 9.0.

 

Cheers, Matt

0 Kudos
Message 1 of 12
(3,825 Views)
OK, tried upgrading to SP1 - this did not work.  Sigh...
0 Kudos
Message 2 of 12
(3,809 Views)

Hi mtat76,

 

Can you attach the code that is crashing?  What is the code doing?

Stephen Meserve
National Instruments
0 Kudos
Message 3 of 12
(3,785 Views)

mtat76 wrote:

Hello all,

 

I have a loop that I would like to configure to operate in parallel, a loop which has been identified as "possibly not parallelizable" - even though there are not interdependencies, I am indexing on the bounds of the array.  The problem comes when I actually try to parallelize the loops and then save - Labview dies everytime and has to be restarted.  Has anyone else seen this? I am using LV 9.0.

 

Cheers, Matt


"Talk is Cheap, show us the code." (Old signature previously used by Michael Avaliotis)

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 12
(3,781 Views)

Haha, Ben.  I think we have been through this before a while back.

 

The code itself is not actually crashing in the traditional sensee.  No errors are being thrown, but when I try to configure for iteration parallelism, Labview dies with NO error (i.e. locks up and has to be shutdown using task manager).  For your edification, I have attached the code with it's dependencies.  The VI in question is called GetTauParams and the loop in question is the  bottom loop which fits a number of exponential decays (a for loop nested in a for loop). 

 

I am not sure which is the best loop to optimize; I can set the inner loop as parallel successfully but I am not achieving the performance boost I expect - execution times vary from those without explicit parallelism to something that is about 4 fold better on a controller with 4 CPUs (the variation is not acceptable as it causes overruns in a higher level loop that ultimately lead to laggy performance). 

 

What this code is supposed to do:

The instrument that this program drives fires lasers at 1 kHz into eight high finesse cavities.  Mirrors allow the light to bounce back in forth for a period time as the residual signal exponentially diminishes due to extinction by gasses and particles.  We measure the 1000 exponential decays in the 8 different cells using an S-series card operating at 2.5 MS/s.  The data (taken from a DAQmx read) is pumped into the class CRDObj (of which there are 8 representing the 8 cells) which is then queued up and sent to a processing loop which calls the VI GetTauParams.  GetTauParams then determines a characteristic decay time (tau) for all 8000 decays.  For each cell, the 1000 decays associated with the cells is then collapsed into a single set of numbers (fitting parameters).  For a thousand point shot, the VI Get Tau is optimized such that, depending on the method, the parameters can be retrieved within 100 to 200 microseconds on a dual core machine.  This translates to about 200 ms for 1000 fits.  If all fits are conducted in series, this would translate to a total acquisition time of ~1.5 to 2 s, well above the 1 Hz that we are shooting for.  However, if we can run reliably in parallel, then we should be able to reduce this by a factor of 4 on a quadcore processor and hit the times that we are shooting for.

 

That's a lot of background which probably doesn't matter, but I thought I might preempt some further questions and hopefully see if any of you had some ideas about optimization.

 

Peace, Matt (NOT mtat76Smiley Wink)

0 Kudos
Message 5 of 12
(3,768 Views)

Hi Matt,

 

There is no such VI in the zip file.

Stephen Meserve
National Instruments
0 Kudos
Message 6 of 12
(3,762 Views)

Sorry Stephen.  I didn't look closely enough.  Here is the VI in question.

 

A new "breakthrough" though (doesn't fix the original problem).  I am not getting the performance I was looking for by making the VI Get Tau reentrant.  However, I am still not able to make the outermost loop in GetTauParams parallelizable without killing LV.  This may ultimately be a CAR.  That being said, feel free to look over the code and give any comments you all have.

 

Peace, Matt

Message Edited by mtat76 on 02-23-2010 11:50 AM
0 Kudos
Message 7 of 12
(3,758 Views)

Hi Matt,

 

Sorry again, but there are far too many (unincluded) dependencies in this VI to make it useful for debugging. That said, I would not like another ZIP file with all the dependencies attached Smiley Wink

 

If you could strip out all the dependencies and isolate the issue into the simplest VI you can manage.  This will help us down the road if it is indeed a CAR-able issue.  Thanks.

Stephen Meserve
National Instruments
0 Kudos
Message 8 of 12
(3,747 Views)

Stephen,

 

Regardless of the dependencies, have you tried to configure for parallel execution?  This is not an execution thing, it is simply a coding thing.  If you can configure for parallel and then save the VI with no problems, that would suggest that there is something wrong on both my systems here (one with SP1 one without).

 

Let me know if you can save it after configuring.  My only aim was to figure out why this was causing catastrophic problems and how to work around it.  Now that I have a reasonable solution, I am only trying to help you guys out by reporting what I think is probably undesirable behavior in the coding environment; unfortunately, I don't have a ton of time to do this.

 

Peace, Matt

0 Kudos
Message 9 of 12
(3,738 Views)

Hi Matt,

 

I can set all three of the for loops to use parallelism and then save the VI successfully.

Stephen Meserve
National Instruments
Message 10 of 12
(3,733 Views)