LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread on dual CPU

Is it possible to ask LabVIEW to execute all subVI in a sigle thread on a dual CPU machine. Our SubVI are calling an API. And this API look for the TheadID to recognise which application is doing the call. We would like to get advantage of multiprocessing. But having all the SubVI call with the same ThreadID?
0 Kudos
Message 1 of 4
(2,916 Views)
Probably not.

Each execution:priority system in LabVIEW gets two threads to service it in multithreaded mode.

So even though you can specify the exact same execution system and priority for each sub vi, you can not be guarantied that you will get the same thread each time.

Good luck.
0 Kudos
Message 2 of 4
(2,916 Views)
> Is it possible to ask LabVIEW to execute all subVI in a sigle thread
> on a dual CPU machine. Our SubVI are calling an API. And this API
> look for the TheadID to recognise which application is doing the call.
> We would like to get advantage of multiprocessing. But having all the
> SubVI call with the same ThreadID?

If you have more than one thread in an execution system, then any of
those threads can be used to execute the VI. In fact, if the code is in
a loop, one iteration of the loop can be run by one thread, and the next
iteration by another thread. It just depends on how the OS happens to
pick threads to execute.

You can setup different VIs to run in different execution systems.
Typically, you will leave most of the subVIs set to run Sam
e as Caller
to inherit the execution system and avoid unnecessary context switches.
You will then set just a few VIs to run in a specific execution system
to control situations like this.

Finally, the default setting will be for each execution system to have a
thread per CPU. You can change this in a couple ways. First off, the
User Interface execution system never has more than one thread. In
fact, there it is the initial thread of the application, and it is used
for all tasks that are unprotected and nonreentrant. A second approach
is to reconfigure one of the other execution systems to have a single
thread. You do this using the vi.lib/utility/threadcfg.llb tool. It
will show the current thread settings and allow them to be modified.
The tool will result in a number of settings being written to the .ini
file. You will want to take those settings with you if you build EXEs.

Greg McKaskle
Message 3 of 4
(2,916 Views)
>Is it possible to ask LabVIEW to execute all subVI in a sigle thread
>on a dual CPU machine. Our SubVI are calling an API. And this API
>look for the TheadID to recognise which application is doing the call.
>We would like to get advantage of multiprocessing. But having all the
>SubVI call with the same ThreadID?

VI Guy wrote:
> Probably not.
>
> Each execution:priority system in LabVIEW gets two threads to service
> it in multithreaded mode.
>
> So even though you can specify the exact same execution system and
> priority for each sub vi, you can not be guarantied that you will get
> the same thread each time.
>
> Good luck.

You should be able to do this. If you go to VI.lib/utility/sysinfo.llb,
you can open a vi called threadconfig.vi
. This will allow you to edit
the number of threads per execution system and priority. So to use VI
Guy's idea, you could set one thread per execution system, then set your
different VI's into different execution systems. Also, you should take
a look at the recent issues of LTR. (www.ltrpub.com) There was an
article there about assigning a specific VI to a specific processor on
multi-processor machines.

Good luck,
Dave

-------------------------------------------------------------
David Thomson 303-499-1973 (voice and fax)
Original Code Consulting dthomson@originalcode.com
www.originalcode.com
National Instruments Alliance Program Member
-------------------------------------------------------------
Research Scientist 303-497-3470 (voice)
NOAA Aeronomy Laboratory 303-497-5373 (fax)
Boulder, Colorado dthomson@al.noaa.gov
--------------------------------------
-----------------------
There are 10 kinds of people: those who understand binary,
and those who don't.
0 Kudos
Message 4 of 4
(2,916 Views)