I use a pattern search algorithm in the simulink toolbox to estimate a set of parameters.
Let's say I have a matlab file that opens a matlabpool and calls pattern search algorithm:
– main.m {
%main calls pattern search
matlabpool open options = psoptimset('UseParallel', 'always') X0 = [0.5 0.5]; % Starting point
[x,fval] = patternsearch(@simple_objective(x),X0)}
I send it to the hpc cluster using the pbs file as follows:
% PBS file
#PBS -l nodes=12 #PBS -l walltime=240:00:00 #PBS -j oe #PBS -l pmem=5gb #PBS -q starxf cd .. matlab -nosplash -nodisplay -r main.m
How can I change this file to use the distributed computing toolbox.
I guess I could not just change the last line to dmatlab ? i.e.
cd .... dmatlab main.m
I understand how simple examples work when a parfor loop is transformed using createTask and then an *.m file is called with dmatlab. But I am new to parallel computing and cannot really wrap my mind about how to do it using the distributed matlab server.
Best Answer