How to improve speed of execution for huge matrix multiplication ?

2 views (last 30 days)
Hi everyone, I am currently working on a neural project in which I need to handle a lot of data. The goal is to minimize this function :
Variables : N = 10 000 000 C = 500 A = vecteur (100, 1) W = matrice (100,100) B = vecteur (100,1)
The problem is that I can't optimize directly this function. Indeed, even if I can make the multiplication in 1e-6s, I would need 500*10000000=5e3s for one step. Thus, I have to vectorize the problem, which is possible in this case. Instead of having a matrix A (100,1), I can transform it to A (100,10000000). The function to minimize become :
If A is a matrix of singles (100,10000000), it means there are 1e9 elements. Each element is coded on 4 bytes. To store this kind of matrix, I would need 4GB of RAM.
Of course, my computer (6GB, 4cores) is not going to handle this type of problem so I thought about cloud computing. I think I should benefit from multiple cores computer (~30) with a big amount of RAM (~200 GB) to parallelize the execution of the function. Do you think I am doing it the right way or should I use GPU calculation instead for example ? If you have any suggestions, please let me know. Thanks in advance.

Answers (1)

Farouk Moukaddem
Farouk Moukaddem on 19 Sep 2016
Hi Edouard,
Refer to the following documentation link for the best practices to improve the performance of code: http://www.mathworks.com/help/matlab/matlab_prog/techniques-for-improving-performance.html
Thanks,
Farouk

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!