|
Hi,
When running a job on a cluster, I have noticed that the 'waitForState' command does not perform as expected. When a function is submitted on a cluster, the simulations progress successfully and all the files/results are generated and saved as expected. However, MATLAB continues to display a 'busy' status, even though the tasks on the cluster have successfully completed. Strangely, rebooting MATLAB and running the task again works (i.e. MATLAB correctly outputs the solutions when the cluster is finished), however over time, the 'waitForState' command again fails. Can you please suggest what is happening?
====================================================
n=5;
clusterHost = 'xxx.xxx.xxx;
remoteDataLocation = '/matlab/';
% Create a job scheduler / manager object:
timeLimit = '00:04:00';
sched = findResource('scheduler', 'type', 'generic');
% Use a local directory as the DataLocation
set(sched, 'DataLocation', 'C:\MATLAB')
set(sched, 'ClusterMatlabRoot', '/matlab/R2008b');
set(sched, 'HasSharedFilesystem', true)
set(sched, 'ClusterOsType', 'unix');
set(sched, 'GetJobStateFcn', @pbsGetJobState);
set(sched, 'DestroyJobFcn', @pbsDestroyJob);
% For parallel job:
set(sched, 'ParallelSubmitFcn', {@pbsNonSharedParallelSubmitFcn, timeLimit, clusterHost, remoteDataLocation});
pjob = createMatlabPoolJob(sched)
set(pjob, 'FileDependencies', {my_func.m'})
% Create and submit the task, wait for results
createTask(pjob, @my_func, 1, {n});
set(pjob,'MinimumNumberOfWorkers',1);
set(pjob,'MaximumNumberOfWorkers',1);
submit(pjob)
waitForState(pjob, 'finished');
results = getAllOutputArguments(pjob)
% celldisp(results);
% Convert to matrices
% result1=results{1,1};
% Close job
destroy(pjob);
|