LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Marc Blumentritt

Parallel For loop

Status: Declined
Available in NI LabVIEW 2009

I read about this idea on LAVA and in fact had this idea a few years before myself: parallel For loops. Of course this does not work with every VI (only reentrant VIs) and shift registers have no function, but it would be cool to start dynamically parallel processes.

 

Regards,

Marc

CLD
15 Comments
Darren
Proven Zealot

It would not be unreasonable to expect to see a feature along these lines in a future LabVIEW version.

 

-D

 

P.S. - I think I'll just start writing the acronym IWNBUTETSAFATLIAFLV as a response to ideas like this.  🙂

tst
Knight of NI Knight of NI
Knight of NI
Put it on a shirt and wear it for NIWeek.

___________________
Try to take over the world!
Intaris
Proven Zealot

I'm glad Darren got in there before I splurted it out....

 

I remembered you saying the exact thing (IWNBUTETSAFATLIAFLV) on the NI forum.

 

Shane.

ozimmer
Member

Hi Marc,

 

 

I really support this idea.

 

I recently had the perfect use case :

- My "ICons" function sends a new setpoint to a power supply (for several reasons, it is and must be reentrant).

- My "ICons.Batch" function (see diagram capture below) does the same for a collection of power supplies. And several other power supply functionalities are implemented in both "single" and "batch" modes.

 

-> Without a "parallel for" structure, I currently have to modify all "batch" functions every time a power supply is added or removed to the "batch list": diagram surface expands, as well as coding error risk and maintainance constraints.

 

-> With a "parallel for" structure, all I'd have to do it modify the "batch list" (and the code would be very concise) .

 

oz

 

 

20100525-140218.jpg

 

Message Edité par ozimmer le 05-25-2010 02:15 PM
RavensFan
Knight of NI
Are you using LV 2009?
Wonger
NI Employee (retired)
Status changed to: Completed
This has already been implemented in LV2009.
Marc Blumentritt
Member

In fact, it is not really completed. The parallel FOR loop mechanisem of LV2009 is capable to work through repetitive tasks, which do not run continuous and which can be paralized.

 

This idea is more like this: a mechanism, which can spawn a at compile time unknown number of continuous parallel processes of the same tool, e.g. TCP-IP server. Since these tools run continuous, it would not work with the parallel loop mechanism of LV2009, if you want to run more processes than processors of the pc.

 

At the moment you have to place statically several instances of the same VI on the block diagramm or do some VI server magic (open VI reference, initialize controls and run without waiting for finish).

CLD
RavensFan
Knight of NI

How do you figure?

 

If you feed your array into the for loop with autoindexing, and set all your enums to be an array of enums that are also autoindexed going into the for loop, turn on parallel processing for the loop, it should work just how I think you are describing you want it to work.

 

Are you taking about parallel threads vs. parallel processors?  Even with numerous threads, there is still a finite number of threads that can run simultaneously.

Marc Blumentritt
Member

Hmm, I was posting without testing, what I was writing about. I try to explain: As far as I understand parallel FOR loops, you have to tell it, how many "workers" it should use (I'm translating from my German version). If you use 2 workers, it starts 2 threads, which are fed with the FOR loop data. If I place continuous running servers in the FOR loop, I was reasoning, that every server gets a thread (or worker). Therefore if I say, use two workers, I can only start two servers. So far right?

 

Now comes perhaps my mistake. I was also reasoning, that the maximum number of workers is the maximum number of (logical) processors. Is this correct?

 

If my assumption is correct, I have a problem, if I want to run 10 servers (or 20 or ...). Of course I know, that there is a finite number of threads, but if the servers are not running 100% of cycle time, it should be possible to run 100 of servers (like every modern server does with all it's file, time, and what you can imagine types of servers).

 

If my assumption is wrong, and I can set N=P="My number of servers", than everything is fine and this idea is completed.

CLD
mfletcher
NI Employee (retired)

The maximum number of workers is the value that you enter in the dialog box for "Number of generated parallel loop instances"; it isn't necessarily related to the number of logical processors on your machine.

 

If "My number of servers" is less than the value you enter in the dialog box, then you can set N=P="My number of servers", and the "servers" will all run in parallel. If it is greater, then some of the "servers" must wait for other "servers" to complete.

 

Should this idea be put back to "New", or do you want to post another idea specifically about allowing dynamic amounts of parallelism?