MATLAB Answers

Periodic Task execution

12 views (last 30 days)
Martin
Martin on 8 Jun 2011
Hi everyone!
This is the first time i am asking a question here in the matlab community. This communitiy is realy very helpfull! Thanks for all the hard-working people answering the questions!
My question is: I am trying to compute several parallel, periodic and independant tasks in a job using the Parallel Computing Toolbox. I am a novice in using this toolbox.
Can somebody tell me if there is a possibility to do something like that? Furthermore i want to exchange data between the tasks. Is there also a solution? Or is there an other possibility to execute some functions in parallel and independant from each other?
Any hints are welcome!
Background knowledge: I am programming an "real-time" Optical Character recognition using a generic web-camera examining a LCD-Display. Because this process is realy time-critical i want to process several parts of the display independantly.
Thanks in advance for your help! Kind regards Martin

  0 Comments

Sign in to comment.

Answers (2)

Sean de Wolski
Sean de Wolski on 8 Jun 2011
You would just have to split the image up using a parfor loop. When each computation is independent this shouldn't be an issue - define the quadrants (example 4 cores) and run it. You can use a timer function to acquire the data and operate the parfor loop.
For tasks that are dependent on others, I know of no solution using PCT. Depending on what the task is, parallelization is not always faster. There is quite a bit of overhead in data transfer so a fast computation with a lot of data will be slower.
Provide a more specific example and we can be more helpful with code.
Welcome to MATLAB Answers!

  0 Comments

Sign in to comment.


Martin
Martin on 9 Jun 2011
Hi Sean!
Thanks for your answer. It´s not that easy that i can split up on 4 cores because it has to be computer independant. So if i have only 2 cores this would not work.
Till now my image processing look like this: First of all, i define Regions of interest (ROI) on a Master Frame (there a 64 Regions) which has to be observed.
1. Initialisation: Map the ROI on the current snapshot Frame (at the beginning). I save the corrected ROI´s as binary Masks.
2. Now i only observe the ROI´s. That saves me a lot of computation time because i dont have to process the whole picture. Furthermore i only start the OCR algorithm for a specific ROI if there is a change between the ROI from the last snapshot Frame and the ROI of the current Frame.
In this second part of my processing i want to split up the masking of the ROI´s because some ROI´s are changing faster than others. So i was thinking of splitting the masking up into two independant periodic processes (workers, matlab instances, tasks or what ever ;-) ).
The task of the periodic processes should be at every iteration:
1. Mask the ROI from the current snapshot.
2. Check if something changed in the ROI´s.
3. If something changed start the OCR algorithm.
So back to my original question:
Is there a possibilitie to start two independant peridodic processes? I was thinking of "spmd" (Single Programm Multiple Data).
Sorry if i don´t post my code. It´s to confusing to understand.
Thanks in advance ! Martin

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!