[965] | 1 | function md=solveparallel(md,options)
|
---|
[1] | 2 | %SOLVEPARALLEL - solution sequence using a cluster in parallel mode
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
[465] | 5 | % md=solveparallel(md);
|
---|
[1] | 6 |
|
---|
[6038] | 7 | %retrieve cluster: otherwise, we can't call its methods (subsref bug)
|
---|
| 8 | cluster=md.cluster;
|
---|
| 9 |
|
---|
[9423] | 10 | if options.loadonly,
|
---|
| 11 | md=loadresultsfromcluster(md);
|
---|
| 12 | else
|
---|
[2912] | 13 |
|
---|
[8109] | 14 | %First, build a runtime name that is unique, that we will use to create
|
---|
| 15 | %directories, name jobs, etc ...
|
---|
[9625] | 16 | c=clock; md.private.runtimename=sprintf('%s-%i-%i-%i-%i-%i-%i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
|
---|
[1] | 17 |
|
---|
[11224] | 18 | if verLessThan('matlab', '7.6')
|
---|
| 19 | BuildQueueScript(cluster,md);
|
---|
| 20 | LaunchQueueJob(cluster,md,options);
|
---|
| 21 | else
|
---|
| 22 | cluster.BuildQueueScript(md);
|
---|
| 23 | cluster.LaunchQueueJob(md,options);
|
---|
| 24 | end
|
---|
[1] | 25 |
|
---|
[8109] | 26 | if ~strcmpi(options.upload,'on'), %did we even try to run? if so, wait on lock
|
---|
| 27 |
|
---|
| 28 | %Do we return, or just wait for results?
|
---|
[9702] | 29 | if (md.settings.waitonlock>0 & ~strcmpi(options.batch,'yes')),
|
---|
[8109] | 30 | %we wait for the done file
|
---|
| 31 | islock=waitonlock(md);
|
---|
| 32 | if islock==0,
|
---|
| 33 | %no results to be loaded
|
---|
| 34 | disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
|
---|
| 35 | else
|
---|
| 36 | %load results
|
---|
| 37 | disp('loading results from cluster');
|
---|
| 38 | md=loadresultsfromcluster(md);
|
---|
| 39 | end
|
---|
[5979] | 40 | end
|
---|
[5357] | 41 |
|
---|
[8109] | 42 | %post processes qmu results if necessary
|
---|
[9650] | 43 | if md.qmu.isdakota,
|
---|
[8109] | 44 | if ~strncmpi(options.keep,'y',1)
|
---|
[8577] | 45 | system(['rm -rf qmu' num2str(feature('GetPid'))]);
|
---|
[8109] | 46 | end
|
---|
[6569] | 47 | end
|
---|
[8109] | 48 | else
|
---|
| 49 | error('solveparallel done uploading test decks');
|
---|
[5979] | 50 | end
|
---|
[9423] | 51 |
|
---|
[5357] | 52 | end
|
---|