Filter löschen
Filter löschen

Task Parallelism in Matlab

3 Ansichten (letzte 30 Tage)
Alrik
Alrik am 16 Feb. 2012
Kommentiert: Priyanagaraj am 12 Okt. 2023
Hello, I'd like to have some task parallelism (as opposed to data parallelism) in a program that I'm writing, but have ran into some issues. Ideally, I'd like to have two distinct functions running concurrently (on the same machine), with the option of sharing data between them. Their data would be different, but obtained from a common source (a DAQ card).
I have access to the parallel computing toolbox, and have been looking at spmd, parfor, distributed parallel Jobs and parallel jobs, but none seem to quite fit what I'm looking for. In C++/Java, I'd just spawn two threads and have them run their respective functions, with a semaphore and some shared memory if I wanted to have any inter-thread communication. However, Matlab doesn't seem to have any analogous functionality to this; I've taken a stab at trying to use the Parallel Toolbox's parallel/distributed Jobs + Tasks, but Matlab assumes I'm trying to run on a cluster (even if I'm using the local scheduler) and seems to insist on serializing, then reconstructing any parameters I pass to the workers (which is a problem, as the DAQ's analoginput needs to either be obtained via the same analoginput object, or have its accesses synchronized, which is something I'd like to avoid).
In addition, as I understand it, the matlab display can only be modified by the main thread, which means that during any of the parallel constructs (i.e. parfor and spmd), the display cannot be updated, which would be another problem I'd have to work around (possibly by having a C++ GUI and updating it via a mex file and some inter-process communication scheme, which seems like a lot of trouble to go to for this).
I guess my question boils down to whether I should continue trying to find some matlab-based task-parallel functionality (i.e. using spmd and having different labs perform different tasks), or if there's a good way to do this in matlab that I haven't found out about yet, or if using matlab will be more trouble than it's worth, and just moving to a non-matlab solution. I'd like to stick with using matlab if possible; if anyone has had prior experience with this, I'd appreciate any insights you have to offer.
Sorry for the long post, and thanks for any help!
-al

Akzeptierte Antwort

Thomas
Thomas am 16 Feb. 2012
Don't know if this will help but NASA has some simple task parallel example for MATLAB on the following wiki page
Some more reading here:
FYI- I Use a lot of task parallelism for Sensor Network Simulations on a cluster, however my task are independent of each other.
  3 Kommentare
Priyanagaraj
Priyanagaraj am 12 Okt. 2023
yes
Priyanagaraj
Priyanagaraj am 12 Okt. 2023
yes

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Parallel Server finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by