cancel
Showing results for 
Search instead for 
Did you mean: 

how create multithreading dynamically?

威海的风
Member

how create multithreading dynamically?

Hi, 

There is a 2D-Array.I need create multithreading for processing it row by row.Is there any way  can do that?If can,please give me a example vi.Thanks a lot!

11 REPLIES 11
RavensFan
Knight of NI

Re: how create multithreading dynamically?

What version of LabVIEW do you have?  LabVIEW 2009 has a new feature on For Loops that allow you to have the iterations run in parallel.

 

What processing do you want to do on each row?  You could use several index array functions to get a particular row, and pass the data off into queues and have parallel while loops operating on the elements that come out of the queues.

威海的风
Member

回复: Re: how create multithreading dynamically?

hi,Ravens Fan

My labview version is 8.5.My Application controls equipments.The data  should process one by one in the same row, but the data can process at the same time in different rows.    

RavensFan
Knight of NI

Re: how create multithreading dynamically?

How many do you want to run at the same time?  Let's say 4.  Use decimate array to break your array into 4 parts.  Feed each part to its own For Loop for processing.  Use Interleave Array to put the results of the 4 loops back together.
威海的风
Member

回复: Re: how create multithreading dynamically?

...Row's number is uncertain,so I should create multithreading dynamically.
Highlighted
RavensFan
Knight of NI

Re: how create multithreading dynamically?

It will handle any number of rows.

 

I don't see any way you can handle an unspecified number of threads.  At some point you are going to have to determine how many different rows you want to be processing at the same time.  There is a practical limit, and that limit isn't that high of a number.  Once you determine how many to process at the same time, then you just decimate your array of whatever size it is among those X number of processes.

威海的风
Member

回复: Re: how create multithreading dynamically?

Message contains a hyperlink Message contains an attachment

Hi,

I create a reentrant vi for processing which is invoked dynamiclly by main vi  in the example.Is it multithreading ?

Baji
Active Participant

Re: 回复: Re: how create multithreading dynamically?

I dont think its mutlithreading (as per the data flow model).
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
威海的风
Member

回复: Re: 回复: Re: how create multithreading dynamically?

Message contains a hyperlink

Hi,Baji

I think the main vi just invokes the process vi and  doesnt wait until it done.Only the time running is different each other. 

Baji
Active Participant

Re: 回复: Re: 回复: Re: how create multithreading dynamically?

Message contains an attachment
In the for loop the process VI waits for the input and it gets executed.So nothing is happening in parallel.Check the attachment
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.