Thread Subject: Managing memory in parfor loops

Subject: Managing memory in parfor loops

From: Bryan Heit

Date: 27 Jul, 2009 19:28:39

Message: 1 of 1

I am working on some scripts to preform image analysis on folders
containing multiple images. To speed things along I am using parfor
loops (the results of one images' analysis does not affect the
analysis of any other images, so this should work).

The problem I am having is that each analysis cycle generates fairly
large arrays of data that are only needed for a small portion each
analysis loop (basically arrays storing intermediary values). Before
using the parfor (when I was just using for loops) I would clear these
arrays once I was done with them, as to avoid potential memory
overflow. However, when I do this in parfor loops, I get the
following caution:

"The function CLEAR might make an invalid workspace access inside the
parfor loop."

What I am wondering is if this means the 'clear' command will clear
the variable in all of the cores (threads?) being used for parallell
processing, rather than in just the one core/thread where the clear
command is being called. By which I mean, if I'm using a dual-core
machine (with cores 'a' and 'b'), calling 'clear' on 'a' will also
clear the same variable in 'b'.

If the above is the case, is there another command that clears the
variable only in one core/thread?

Thanx

Bryan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
image analysis Sprinceana 21 Aug, 2009 07:26:43
manage memory Sprinceana 21 Aug, 2009 07:26:36
parfor Sprinceana 21 Aug, 2009 07:26:36
memory Sprinceana 21 Aug, 2009 07:26:36
parfor loops Sprinceana 21 Aug, 2009 07:26:36
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com