Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thrread in Matlab

Status
Not open for further replies.

alhowaidi

Computer
Oct 17, 2013
1
[highlight #E9B96E]Hello,
I wonder if Matlab has threading. I am doing sum processing for data and save the result in an array. I am wonder if I can write the array (partial result) to a file and continue processing without interruption. It seem that I should have 2 thread one responsible about processing the data and save them to the array while the second thread write the array into a file. Any suggestion how to handle this issue.

Thanks,[/highlight]
 
Replies continue below

Recommended for you

Please don't highlight your own messages, the board software handles that.

Yes, matlab can do parallel processing

from the help

Implicit Multiprocessing

Characteristics of implicit multiprocessing:

*

Runs multiple threads on a single machine, most often using one thread per processing unit.
*

Requires a multiple CPU (multiprocessor or multicore) system.
*

Speeds up elementwise computations such as those done by the sin and log functions, and computations that use the Basic Linear Algebra Subroutines (BLAS) library, such as matrix multiply.
*

Does not require any changes to your MATLAB code.
*

Works behind the scenes to take advantage of the processing units available to you. It does this by multithreading the computationally-intensive math library functions that you use in the course of your MATLAB session.

MATLAB enables multithreaded computation by default. You can disable it by specifying the singleCompThread option when starting MATLAB.
Explicit Multiprocessing

Characteristics of explicit multiprocessing:

*

Runs separate processes on one or many machines.
*

Requires installation of Parallel Computing Toolbox.
*

Speeds up execution of large MATLAB jobs. Enables you to run jobs simultaneously on a cluster of computers, or as several processes on a single machine.
*

Requires that you modify your MATLAB code.
*

The Parallel Computing Toolbox supports programming constructs for distributed arrays and parallel for (parfor) loops. It also supports both interactive and batch execution.

Enable explicit multiprocessing by installing Parallel Computing Toolbox.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
However, if you only have one drive and you're memory swapping while writing to a file, there will be contention for resources.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor