I have two identical computers, both with 4 dual cores and MATLAB installed on them. They are connected to the same network.

Is there anyway I can run a parforloop using the computation power of both machines without relying on MATLAB distributed computing server? I do not have a license for this, and seems to expensive to connect just two computers.

  • $\begingroup$ parfor works only with the parallel computing toolbox, distributed computing server, or the MATLAB Coder. You could also try to split your problem in two independent tasks (domain decomposition, etc) that can be run in parallel on your two MATLAB boxes. Also, the most common linear algebra operations (lu, fft, backslash) are multithreaded by default, so you should see an improvement over single-core machines for large-enough array sizes. $\endgroup$ – GoHokies Oct 10 '16 at 18:11
  • $\begingroup$ Split the problem does not work as the structure of the code is such that the parfor loop is run several times depending on an outer non-paralellizable outer loop. $\endgroup$ – phdstudent Oct 10 '16 at 20:24
  • $\begingroup$ I made a tool for performing similar tasks once. The idea is to communicate between the nodes through a filesystem (you must be able to mount a network filesystem that is shared between the two systems). The overhead is so large that it only makes sense if each iteration takes long, say over 5 minutes or so. You can find the code in GitHub if you want to take a look. There is an example but the documentation is otherwise quite bad. I've successfully used this to compute Monte Carlo nonlinear FEM computations simultaneously on 30 or so computers. $\endgroup$ – knl Oct 13 '16 at 7:19
  • $\begingroup$ There is an falternative available on Mathworks File Exchange here. $\endgroup$ – Abhinav Nov 20 '18 at 21:15

The short answer is "no", you cannot run a parfor loop without the distributed computing toolbox. You would have to do it manually, by setting up a system for communicating between the two matlab sessions, for sharing data, and for remotely executing commands. All of which is possible.

There are a small number of packages that will take care of this for you:

I have not used either, so I cannot make a recommendation.

| cite | improve this answer | |
  • $\begingroup$ There is an free alternative to Matlab Distributed Computing Server available on Mathworks File Exchange [here][1]. It may not be as refined but its highly rated with 72 five star ratings till now. [1]: mathworks.com/matlabcentral/fileexchange/13775 $\endgroup$ – Abhinav Nov 20 '18 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.