%ERIC-MAC class definition % % Usage: % cluster=eric-mac(); % classdef ericmac properties (SetAccess=public) % {{{1 name='eric-mac' login='larour'; np=3; port=0; codepath=[issmdir() '/bin']; executionpath=[issmdir() '/../execution']; valgrind=[issmdir() '/externalpackages/valgrind/install/bin/valgrind']; valgrindlib=[issmdir() '/externalpackages/valgrind/install/lib/libmpidebug.so']; valgrindsup=[issmdir() '/externalpackages/valgrind/issm.supp']; %}}} end methods function cluster=ericmac(varargin) % {{{1 options=pairoptions(varargin{:}); for i=1:size(options.list,1), fieldname=options.list{i,1}; fieldvalue=options.list{i,2}; if ismember(fieldname,properties(ericmac)), cluster.(fieldname)=fieldvalue; else disp(['''' fieldname ''' is not a property of cluster ericmac']); end end end %}}} function disp(cluster) % {{{1 % display the object disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); disp(sprintf(' name: %s',cluster.name)); disp(sprintf(' login: %s',cluster.login)); disp(sprintf(' np: %i',cluster.np)); disp(sprintf(' port: %i',cluster.port)); disp(sprintf(' codepath: %s',cluster.codepath)); disp(sprintf(' executionpath: %s',cluster.executionpath)); disp(sprintf(' valgrind: %s',cluster.valgrind)); disp(sprintf(' valgrindlib: %s',cluster.valgrindlib)); disp(sprintf(' valgrindsup: %s',cluster.valgrindsup)); end %}}} function IsConsistent(cluster) % {{{1 if cluster.np>4, error('IsConsistent error message: number of processors should be lest than 16!'); end if isnan(cluster.np), error('IsConsistent error message: number of processors should not be NaN!'); end end %}}} function BuildQueueScript(cluster,modelname,analysis_type,mem_debug) % {{{1 %open file for writing: fid=fopen([modelname '.queue'],'w'); %write instructions for launching a job on the cluster fprintf(fid,'#!/bin/sh\n'); if mem_debug==0, 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); else %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); 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); end %close file fclose(fid); end %}}} function command=LaunchCommand(cluster,modelruntimename,modelname)% {{{1 command=['cd ' cluster.executionpath ' && rm -rf ./' modelruntimename ' && mkdir ' modelruntimename ' && cd ' modelruntimename ' && mv ../' modelruntimename '.tar.gz ./ && tar -zxf ' modelruntimename '.tar.gz && source ' modelname '.queue ']; end %}}} end end