source: issm/trunk/src/m/classes/@modellist/solve.m@ 2952

Last change on this file since 2952 was 2952, checked in by Eric.Larour, 15 years ago

Weirdest bug in solve.m, still don't understand it. Renamed md to model, so that
this routine does not modify the model md from which the list of models was extracted -> don't ask,
makes no sense.

loadmultipleresultsfromcluster: load list of results.

File size: 2.2 KB
Line 
1function mds=solve(mds,varargin)
2%SOLVE - apply solution sequence for a list of models. Used in batch mode.
3%
4% Usage:
5% mds=solve(mds,varargin)
6% where varargin is a lit of paired arguments.
7% arguments can be: 'analysis_type': 'diagnostic','thermal','prognostic','transient'
8% arguments can be: 'sub_analysis_type': 'transient','steady','' (default if empty = 'steady')
9%
10% Examples:
11% mds=solve(mds,'analysis_type','diagnostic');
12% mds=solve(mds,'analysis_type','thermal','sub_analysis_type','transient');
13% mds=solve(mds,'analysis_type','thermal','sub_analysis_type','steady');
14% mds=solve(mds,'analysis_type','thermal');
15
16%recover options
17options=pairoptions(varargin{:});
18
19%add default options
20options=process_solve_options(options);
21
22%length of list
23nummodels=length(mds.models);
24
25%name of queue: to make it unique, add a time stamp
26name=[mds.name '-' datestr(now,1) '-' datestr(now,'HH-MM-SS') ];
27
28%name of cluster will be first name of list
29cluster=mds.cluster;
30
31%Figure out parameters for this particular cluster
32cluster_rc_location=which('cluster.rc');
33[codepath,executionpath]=ClusterParameters(cluster,cluster_rc_location);
34
35%solve in batch mode:
36for i=1:nummodels,
37
38 %model
39 mdex=mds.models{i};
40
41 %recover some fields
42 mdex.analysis_type=options.analysis_type;
43 mdex.sub_analysis_type=options.sub_analysis_type;
44
45 mdex.name=[name '-' num2str(i) 'vs' num2str(nummodels)];
46 mdex.time=mds.time;
47 mdex.queue=mds.queue;
48 mdex.cluster=mds.cluster;
49 if ~isnan(mds.np),
50 mdex.np=mds.np;
51 end
52
53 %call solve in batch mode:
54 if strcmpi(cluster,oshostname),
55 mdex=solve(mdex,varargin{:});
56 else
57 mdex=solve(mdex,varargin{:},'batch','yes','directory',name);
58 end
59
60 %feed back
61 mds.models{i}=mdex;
62end
63
64%locally, we are done.
65if strcmpi(cluster,oshostname),
66 return
67end
68
69
70%now, tar all the files and then erase them.
71eval(['!find -iname ''' name '-*'' > file_list.txt']);
72!tar zcvf ModelList.tar.gz --files-from file_list.txt
73!rm -rf *.bin *.queue file_list.txt
74
75%still have to build a launching script.
76BuildMultipleQueueingScript(cluster,name,executionpath,codepath);
77
78%launch jobs on remote cluster
79LaunchMultipleQueueJob(cluster,name,executionpath);
80
81%erase files:
82delete([name '.queue']);
83delete('ModelList.tar.gz');
84
85%save name:
86mds.name=name;
Note: See TracBrowser for help on using the repository browser.