source: issm/trunk/src/m/classes/clusters/maceric.m@ 8188

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

Added macmathieu and fixed maceric for valgrind

File size: 5.3 KB
Line 
1%ERICMAC class definition
2%
3% Usage:
4% cluster=ericmac();
5% cluster=ericmac('np',3);
6% cluster=ericmac('np',3,'login','username');
7
8classdef ericmac
9 properties (SetAccess=public)
10 % {{{1
11 name='ericmac'
12 login='larour';
13 np=3;
14 port=0;
15 codepath=[issmtier() '/bin'];
16 executionpath=[issmdir() '/execution'];
17 valgrind=[issmtier() '/externalpackages/valgrind/install/bin/valgrind'];
18 valgrindlib=[issmtier() '/externalpackages/valgrind/install/lib/libmpidebug.so'];
19 valgrindsup=[issmtier() '/externalpackages/valgrind/issm.supp'];
20 %}}}
21 end
22 methods
23 function cluster=ericmac(varargin) % {{{1
24 options=pairoptions(varargin{:});
25 for i=1:size(options.list,1),
26 fieldname=options.list{i,1};
27 fieldvalue=options.list{i,2};
28 if ismember(fieldname,properties(ericmac)),
29 cluster.(fieldname)=fieldvalue;
30 else
31 disp(['''' fieldname ''' is not a property of cluster ericmac']);
32 end
33 end
34 end
35 %}}}
36 function disp(cluster) % {{{1
37 % display the object
38 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
39 disp(sprintf(' name: %s',cluster.name));
40 disp(sprintf(' login: %s',cluster.login));
41 disp(sprintf(' np: %i',cluster.np));
42 disp(sprintf(' port: %i',cluster.port));
43 disp(sprintf(' codepath: %s',cluster.codepath));
44 disp(sprintf(' executionpath: %s',cluster.executionpath));
45 disp(sprintf(' valgrind: %s',cluster.valgrind));
46 disp(sprintf(' valgrindlib: %s',cluster.valgrindlib));
47 disp(sprintf(' valgrindsup: %s',cluster.valgrindsup));
48 end
49 %}}}
50 function IsConsistent(cluster) % {{{1
51 if cluster.np>4,
52 error('IsConsistent error message: number of processors should be less than 4!');
53 end
54 if isnan(cluster.np),
55 error('IsConsistent error message: number of processors should not be NaN!');
56 end
57 end
58 %}}}
59 function BuildQueueScript(cluster,md) % {{{1
60
61 %retrieve parameters
62 modelname=md.name;
63 solution_type=md.solution_type;
64 mem_debug=md.mem_debug;
65
66 %open file for writing:
67 fid=fopen([modelname '.queue'],'w');
68
69 %write instructions for launching a job on the cluster
70 fprintf(fid,'#!/bin/sh\n');
71 if mem_debug==0,
72 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s.bin %s.petsc %s.outbin %s.lock 2> %s.errlog >%s.outlog & ',cluster.np,cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
73 else
74 %fprintf(fid,'LD_PRELOAD=%s mpirun -np %i %s --leak-check=full --gen-suppressions=all --suppressions=%s %s/issm.exe %s %s %s.bin %s.petsc %s.outbin %s.lock 2> %s.errlog >%s.outlog & ',cluster.valgrindlib,cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
75 fprintf(fid,'LD_PRELOAD=%s mpirun -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s.bin %s.petsc %s.outbin %s.lock 2> %s.errlog >%s.outlog & ',cluster.valgrindlib,cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
76 end
77
78 %close file
79 fclose(fid);
80
81 end
82 %}}}
83 function LaunchQueueJob(cluster,md,options)% {{{1
84
85 %lauch command, to be executed via ssh
86 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.runtimename ' && mkdir ' md.runtimename ...
87 ' && cd ' md.runtimename ' && mv ../' md.runtimename '.tar.gz ./ && tar -zxf ' md.runtimename '.tar.gz && source ' md.name '.queue '];
88
89 if ~strcmpi(options.batch,'yes'),
90
91 %compress the files into one zip.
92 compressstring=['tar -zcf ' md.runtimename '.tar.gz ' md.name '.bin ' md.name '.queue ' md.name '.petsc '];
93 if md.qmu_analysis,
94 compressstring=[compressstring md.name '.qmu.in'];
95 end
96 system(compressstring);
97
98 disp('uploading input file and queueing script');
99 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.runtimename '.tar.gz']});
100
101 disp('launching solution sequence on remote cluster');
102 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand);
103
104 else
105 disp('batch mode requested: not launching job interactively');
106 disp('launch solution sequence on remote cluster by hand');
107 end
108
109 end
110 %}}}
111 function Download(cluster,md)% {{{1
112
113 %some check
114 if isempty(md.runtimename),
115 error('pfe Download error message: supply runtime name for results to be loaded!');
116 end
117
118 %Figure out the directory where all the files are in:
119 directory=[cluster.executionpath '/' md.runtimename '/'];
120
121 %What packages are we picking up from remote cluster
122 packages={[md.name '.outlog'],[md.name '.errlog']};
123 if md.qmu_analysis,
124 packages{end+1}=[md.name '.qmu.err'];
125 packages{end+1}=[md.name '.qmu.out'];
126 if isfield(md.qmu_params,'tabular_graphics_data'),
127 if md.qmu_params.tabular_graphics_data==true,
128 packages{end+1}='dakota_tabular.dat';
129 end
130 end
131 else
132 packages{end+1}=[md.name '.outbin'];
133 end
134
135 %copy files from cluster to present directory
136 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
137 end %}}}
138 end
139end
Note: See TracBrowser for help on using the repository browser.