GA long time for first generation (parallel pool delayed)
2 views (last 30 days)
Suddenly, several days ago, Matlab (2018a, running on Linux Ubuntu 18.04) started spitting out the results (I have Display on 'iter') for the first generation of GA calculations after many hours. Once the first generation appears, the rest of the results run as before, with about 2 min per generation. I am using parallel computing (options.UseParallel = 1), and these run on two GPUs (NVidia GeForce GTX 1080 Ti). The announcement of starting a parallel pool also comes after many hours, just before the first generation is calculated. I'm wondering what might be the cause for this delay? The delay is also interestingly dependent on the population size. If options.PopulationSize is, say, 400, the delay is about 2 hours. If options.PopulationSize is set to 1500, the delay is about 12 hours.
In my frustration, I have installed R2019a, but this step has not solved the problem.
Any help, obviously, would be greatly appreciated. Lots of GPU time wasted here.
Etsuo Maeda on 21 Jun 2019
"ga" calculates twice in the 1st generation when you did not set initial parameters, e.g. initialScoresMatrix.
"UseParallel = 1" cannot promise any faster calculation when you put huge amount of small-sized data.
You can confirm those behavior with following simple codes:
opts = optimoptions('ga');
opts.Display = 'iter';
opts.MaxGenerations = 10;
opts.PopulationSize = 5;
opts.UseParallel = 1; % 1 or 0
opts.InitialScoresMatrix = [0.5, 0.5, 5, 0.5, 0.5]; % set or ignore
[x,fval,exitflag,output,population,scores] = ga(@myFun, 3, , , , , , , , opts);
function y = myFun(x)
y = abs(x(1) + x(2) + x(3));
I am not sure your "the first generation of GA calculations after many hours" but if it takes too long time to startup your parallel pool, there might be a license issue. When you have several licenses in your MATLAB (local, network, home, student, etc.), sometimes MATLAB takes long long long time to findout the license which includes a parallel computing toolbox license. You can confirm your licenses in your machine with following command:
If there were unnecessary license files, please delete thoese files.