[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 |
|
---|
[11729] | 14 | %In parallel mode, we need to make sure we have PETSC support, otherwise, we run with only one cpu:
|
---|
| 15 | if ~ispetsc,
|
---|
| 16 | disp('PETSC support not included, running on 1 cpu only!');
|
---|
| 17 | cluster.np=1;
|
---|
| 18 | end
|
---|
| 19 |
|
---|
[8109] | 20 | %First, build a runtime name that is unique, that we will use to create
|
---|
| 21 | %directories, name jobs, etc ...
|
---|
[11311] | 22 | c=clock; md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
|
---|
[1] | 23 |
|
---|
[11224] | 24 | if verLessThan('matlab', '7.6')
|
---|
| 25 | BuildQueueScript(cluster,md);
|
---|
| 26 | LaunchQueueJob(cluster,md,options);
|
---|
| 27 | else
|
---|
| 28 | cluster.BuildQueueScript(md);
|
---|
| 29 | cluster.LaunchQueueJob(md,options);
|
---|
| 30 | end
|
---|
[1] | 31 |
|
---|
[8109] | 32 | if ~strcmpi(options.upload,'on'), %did we even try to run? if so, wait on lock
|
---|
| 33 |
|
---|
| 34 | %Do we return, or just wait for results?
|
---|
[9702] | 35 | if (md.settings.waitonlock>0 & ~strcmpi(options.batch,'yes')),
|
---|
[8109] | 36 | %we wait for the done file
|
---|
| 37 | islock=waitonlock(md);
|
---|
| 38 | if islock==0,
|
---|
| 39 | %no results to be loaded
|
---|
| 40 | disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
|
---|
| 41 | else
|
---|
| 42 | %load results
|
---|
| 43 | disp('loading results from cluster');
|
---|
| 44 | md=loadresultsfromcluster(md);
|
---|
| 45 | end
|
---|
[5979] | 46 | end
|
---|
[5357] | 47 |
|
---|
[8109] | 48 | %post processes qmu results if necessary
|
---|
[9650] | 49 | if md.qmu.isdakota,
|
---|
[8109] | 50 | if ~strncmpi(options.keep,'y',1)
|
---|
[8577] | 51 | system(['rm -rf qmu' num2str(feature('GetPid'))]);
|
---|
[8109] | 52 | end
|
---|
[6569] | 53 | end
|
---|
[8109] | 54 | else
|
---|
| 55 | error('solveparallel done uploading test decks');
|
---|
[5979] | 56 | end
|
---|
[9423] | 57 |
|
---|
[5357] | 58 | end
|
---|