MATLAB: Linear least squares/mldivide for large matrices in parallel

least squaresMATLABparallel computing

I have a really large system to solve using linear least squares. The A matrix can have 2-3 million rows and 2000-3000 columns. The B matrix has same row size but with a single column.
I have access to a supercomputer, and I want to run the x = A\B (or) mldivide(A,B) command in parallel, since I can easily run out of RAM even on workstations with lots of memory.
Any ideas? I am able to run EIG and SVD without any issues in parallel, since I assume it is automatically parallelized by MATLAB. What about linear least squares? Suggestions outside of MATLAB are also welcome. Thanks.

Best Answer

If you have access to a cluster of machines, you could use distributed arrays to solve the large system in parallel using the multiple memories. You'll need MATLAB Distributed Computing Server worker licenses on the cluster, and Parallel Computing Toolbox on the client machine. Something like this:
parpool();
A = distributed.rand(20000,2000);
b = sum(A, 2);
x = A\b;