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

Last change on this file since 7629 was 7629, checked in by Mathieu Morlighem, 14 years ago

moved md.analysis_type to md.solution_type

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