2-cent tip: Use them cores on MATLAB

by Amit


Optimisation using Evolutionary Algorithms is a stochastic process. This makes it a fundamental requirement to “test” your algorithm using a number of different initial random seeds. Thus, several runs ranging from 10-30 of an algorithm are made to make a proper inference about its performance. Essentially this looks like:


FOR I = 1:MAXRUNS
.
"your algorithm"
.
END

This is essentially a sequential process and is a time consuming one. Even if you don’t have a cluster of nodes, but have a multi-core CPU at your disposal, you can easily make these runs run simultaneously on the multiple-cores using a couple of simple MATLAB constructs: matlabpool and parfor

First declare the number of worker labs using matlabpool open 3 . For example, if you have a quad-core box, you might want to set it to 3.  Then replace the FOR in above loop, by a parfor. Now you will see that there will be three MATLAB processes and three of your runs going on simultaneously.

Advertisements