What is the difference between "MATLAB as a fully-multithreaded application" versus "multithreaded computation"?
4 views (last 30 days)
The documentation for MATLAB 7.4 (R2007a) says: "If you run MATLAB on a multiple-CPU system (multiprocessor or multicore), you can use multithreaded computation, which can improve performance for some operations".
Several questions have arisen in relation to the multithreading capabilities provided in recent versions of MATLAB. The purpose of this solution is to address these questions:
This change has been incorporated into the documentation in Release 2010a (R2010a). For previous releases, read below for any additional information:
1. Is MATLAB's multithreading limited to the low-level linear algebra and elementwise operations?
When you check the "Enable multithreaded computation" box in the Preferences window, MATLAB enables certain ones of its underlying libraries to create multiple computational threads. This may lead to a performance improvement. The degree of improvement on performance depends on the nature of the computation, your machine, and whether or not your operating system can leverage these multiple threads.
2. After starting execution of a computation-intensive program, can I immediately regain useful control of MATLAB from the command prompt and do other useful work on a different thread?
When you use MATLAB as a fully-multithreaded application, you have the ability to begin execution on a computationally intense file at the Command Prompt, and then immediately regain useful control of the MATLAB command line. This is true even when your file takes several minutes to run before returning control on a single-core machine. Control is quickly returned to you because your program is executed on a separate thread.
This has been implemented for a subset of MATLAB functionality, such as the Data Acquisition Toolbox engine, or certain Java functionality. This is not the case, however, in MATLAB 7.4 (R2007a), nor is it what is generally meant by "multithreaded computation".
3. Is there a general threading API in MATLAB? For instance, can I programmatically spawn new threads, etc.?
In general, the user does not have low-level control of these threads, and MATLAB does not provide a general threading API.