1 | function md=solveparallel(md,options)
|
---|
2 | %SOLVEPARALLEL - solution sequence using a cluster in parallel mode
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % md=solveparallel(md);
|
---|
6 |
|
---|
7 | %retrieve cluster: otherwise, we can't call its methods (subsref bug)
|
---|
8 | cluster=md.cluster;
|
---|
9 |
|
---|
10 | if options.loadonly,
|
---|
11 | md=loadresultsfromcluster(md);
|
---|
12 | else
|
---|
13 |
|
---|
14 | %First, build a runtime name that is unique, that we will use to create
|
---|
15 | %directories, name jobs, etc ...
|
---|
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'));
|
---|
17 |
|
---|
18 | %Now, we need to build the queuing script, used by the cluster to launch the job.
|
---|
19 | cluster.BuildQueueScript(md);
|
---|
20 |
|
---|
21 | %Now, launch the queueing script
|
---|
22 | cluster.LaunchQueueJob(md,options);
|
---|
23 |
|
---|
24 | if ~strcmpi(options.upload,'on'), %did we even try to run? if so, wait on lock
|
---|
25 |
|
---|
26 | %Do we return, or just wait for results?
|
---|
27 | if (md.settings.waitonlock>0 & ~strcmpi(options.batch,'yes')),
|
---|
28 | %we wait for the done file
|
---|
29 | islock=waitonlock(md);
|
---|
30 | if islock==0,
|
---|
31 | %no results to be loaded
|
---|
32 | disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
|
---|
33 | else
|
---|
34 | %load results
|
---|
35 | disp('loading results from cluster');
|
---|
36 | md=loadresultsfromcluster(md);
|
---|
37 | end
|
---|
38 | end
|
---|
39 |
|
---|
40 | %post processes qmu results if necessary
|
---|
41 | if md.qmu.isdakota,
|
---|
42 | if ~strncmpi(options.keep,'y',1)
|
---|
43 | system(['rm -rf qmu' num2str(feature('GetPid'))]);
|
---|
44 | end
|
---|
45 | end
|
---|
46 | else
|
---|
47 | error('solveparallel done uploading test decks');
|
---|
48 | end
|
---|
49 |
|
---|
50 | end
|
---|