1 | %ERIC-MAC class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % cluster=eric-mac();
|
---|
5 | %
|
---|
6 | classdef ericmac
|
---|
7 | properties (SetAccess=public)
|
---|
8 | % {{{1
|
---|
9 | name='eric-mac'
|
---|
10 | login='larour';
|
---|
11 | np=3;
|
---|
12 | port=0;
|
---|
13 | codepath=[issmdir() '/bin'];
|
---|
14 | executionpath=[issmdir() '/../execution'];
|
---|
15 | valgrind=[issmdir() '/externalpackages/valgrind/install/bin/valgrind'];
|
---|
16 | valgrindlib=[issmdir() '/externalpackages/valgrind/install/lib/libmpidebug.so'];
|
---|
17 | valgrindsup=[issmdir() '/externalpackages/valgrind/issm.supp'];
|
---|
18 | %}}}
|
---|
19 | end
|
---|
20 | methods
|
---|
21 | function cluster=ericmac(varargin) % {{{1
|
---|
22 | options=pairoptions(varargin{:});
|
---|
23 | for i=1:size(options.list,1),
|
---|
24 | fieldname=options.list{i,1};
|
---|
25 | fieldvalue=options.list{i,2};
|
---|
26 | if ismember(fieldname,properties(ericmac)),
|
---|
27 | cluster.(fieldname)=fieldvalue;
|
---|
28 | else
|
---|
29 | disp(['''' fieldname ''' is not a property of cluster ericmac']);
|
---|
30 | end
|
---|
31 | end
|
---|
32 | end
|
---|
33 | %}}}
|
---|
34 | function disp(cluster) % {{{1
|
---|
35 | % display the object
|
---|
36 | disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
|
---|
37 | disp(sprintf(' name: %s',cluster.name));
|
---|
38 | disp(sprintf(' login: %s',cluster.login));
|
---|
39 | disp(sprintf(' np: %i',cluster.np));
|
---|
40 | disp(sprintf(' port: %i',cluster.port));
|
---|
41 | disp(sprintf(' codepath: %s',cluster.codepath));
|
---|
42 | disp(sprintf(' executionpath: %s',cluster.executionpath));
|
---|
43 | disp(sprintf(' valgrind: %s',cluster.valgrind));
|
---|
44 | disp(sprintf(' valgrindlib: %s',cluster.valgrindlib));
|
---|
45 | disp(sprintf(' valgrindsup: %s',cluster.valgrindsup));
|
---|
46 | end
|
---|
47 | %}}}
|
---|
48 | function IsConsistent(cluster) % {{{1
|
---|
49 | if cluster.np>4,
|
---|
50 | error('IsConsistent error message: number of processors should be lest than 16!');
|
---|
51 | end
|
---|
52 | if isnan(cluster.np),
|
---|
53 | error('IsConsistent error message: number of processors should not be NaN!');
|
---|
54 | end
|
---|
55 | end
|
---|
56 | %}}}
|
---|
57 | function BuildQueueScript(cluster,modelname,analysis_type,mem_debug) % {{{1
|
---|
58 |
|
---|
59 | %open file for writing:
|
---|
60 | fid=fopen([modelname '.queue'],'w');
|
---|
61 |
|
---|
62 | %write instructions for launching a job on the cluster
|
---|
63 | fprintf(fid,'#!/bin/sh\n');
|
---|
64 | if mem_debug==0,
|
---|
65 | 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(analysis_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
|
---|
66 | else
|
---|
67 | %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(analysis_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
|
---|
68 | 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(analysis_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);
|
---|
69 | end
|
---|
70 |
|
---|
71 | %close file
|
---|
72 | fclose(fid);
|
---|
73 |
|
---|
74 | end
|
---|
75 | %}}}
|
---|
76 | function command=LaunchCommand(cluster,modelruntimename,modelname)% {{{1
|
---|
77 | command=['cd ' cluster.executionpath ' && rm -rf ./' modelruntimename ' && mkdir ' modelruntimename ' && cd ' modelruntimename ' && mv ../' modelruntimename '.tar.gz ./ && tar -zxf ' modelruntimename '.tar.gz && source ' modelname '.queue '];
|
---|
78 | end
|
---|
79 | %}}}
|
---|
80 | end
|
---|
81 | end
|
---|