On the performance of Matlab and Parallel Computing

MATLAB is one of the most powerful scientific computing tools along with Python. Although Python is my favorite scientific programming language since it is opensource, well-documented and has plenty of libraries, I sometimes use MATLAB especially while dealing with very large matrices as MATLAB is highly optimized for large-scale matrix operations, consequently, it performs better at processing very large matrices.

From a parallel computing perspective, MATLAB actually strives to utilize all available CPU cores in a parallel way to maximize its performance and reduce the computation time when it is possible. Therefore, it does a kind of parallel computing when it is possible such as in matrix operations as these operations are very suitable to be run parallelly.  However, the parallel operation of the MATLAB might be restricted by bad coding practice of the users especially using for or while loops, because those loops are generally performed in a serial manner with an increasing or decreasing index.  Of course, MATLAB has advanced parallel processing libraries for more detailed operations, however, the best way to shorten the computing time and improve the performance of the calculation is avoiding implementing loops. For example, instead of performing K times MxN matrix multiplications in a loop, simply one KxMxN matrix (K, M, N are big numbers) multiplication would be enough, then the result matrix could be sliced if necessary for further operations. This would shorten the computation time by a great amount (10 times or more depending on the matrix size and operation) as this operation could be performed parallelly by Matlab using its core libraries.

Popular posts from this blog

DFT and FFT with Python and It is applications on various signals

Matlab Phased Array Toolbox and Radar Examples