Changeset 8586
- Timestamp:
- 06/09/11 10:04:11 (14 years ago)
- Location:
- issm/trunk/src/m/classes/clusters
- Files:
-
- 7 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/clusters/README
r5956 r8586 9 9 10 10 How to add your cluster? 11 use an existing cluster script, such as p leiades.m, and rename it to your cluster name.11 use an existing cluster script, such as pfe.m, and rename it to your cluster name. 12 12 update the methods. -
issm/trunk/src/m/classes/clusters/astrid.m
r8246 r8586 25 25 function cluster=astrid(varargin) % {{{1 26 26 27 %initialize cluster using user settings if provided 28 if (exist('astrid_settings')==2), astrid_settings; end 29 30 %use provided options to change fields 31 options=pairoptions(varargin{:}); 32 for i=1:size(options.list,1), 33 fieldname=options.list{i,1}; 34 fieldvalue=options.list{i,2}; 35 if ismember(fieldname,properties(astrid)), 36 cluster.(fieldname)=fieldvalue; 37 else 38 disp(['''' fieldname ''' is not a property of cluster astrid']); 39 end 40 end 27 disp( '!!! '); 28 disp( '!!! WARNING'); 29 disp(['!!! ''astrid'' is now deprecated. Please use the generic cluster instead']); 30 disp(['!!! ''generic'' uses the same properties as ''astrid'' but the option ''name'' is now mandatory:']); 31 disp(['!!! Ex: md.cluster=generic(''name'',oshostname,''np'',3);']); 32 disp( '!!! '); 33 error('''astrid'' not supported anymore'); 41 34 end 42 35 %}}} 43 function disp(cluster) % {{{144 % display the object45 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));46 disp(sprintf(' name: %s',cluster.name));47 disp(sprintf(' login: %s',cluster.login));48 disp(sprintf(' np: %i',cluster.np));49 disp(sprintf(' port: %i',cluster.port));50 disp(sprintf(' codepath: %s',cluster.codepath));51 disp(sprintf(' executionpath: %s',cluster.executionpath));52 disp(sprintf(' valgrind: %s',cluster.valgrind));53 disp(sprintf(' valgrindlib: %s',cluster.valgrindlib));54 disp(sprintf(' valgrindsup: %s',cluster.valgrindsup));55 end56 %}}}57 function IsConsistent(cluster) % {{{158 if cluster.np>16,59 error('IsConsistent error message: number of processors should be less than 16!');60 end61 if isnan(cluster.np),62 error('IsConsistent error message: number of processors should not be NaN!');63 end64 end65 %}}}66 function BuildQueueScript(cluster,md) % {{{167 68 %retrieve parameters69 modelname=md.name;70 solution_type=md.solution_type;71 mem_debug=md.mem_debug;72 73 %open file for writing:74 fid=fopen([modelname '.queue'],'w');75 76 %write instructions for launching a job on the cluster77 fprintf(fid,'#!/bin/sh\n');78 if mem_debug==0,79 if cluster.interactive80 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s.bin %s.petsc %s.outbin %s.lock ',...81 cluster.np,cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname);82 else83 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s.bin %s.petsc %s.outbin %s.lock 2> %s.errlog >%s.outlog ',...84 cluster.np,cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);85 end86 else87 %fprintf(fid,'LD_PRELOAD=%s mpiexec -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);88 fprintf(fid,'LD_PRELOAD=%s mpiexec -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 ',...89 cluster.valgrindlib,cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution_type),cluster.executionpath,modelname,modelname,modelname,modelname,modelname,modelname);90 end91 92 if md.gprof,93 fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);94 end95 96 if ~md.io_gather,97 %concatenate the output files:98 fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);99 end100 101 %in interactive mode, create a run file, and errlog and outlog file102 if cluster.interactive,103 fid=fopen([modelname '.errlog'],'w'); fclose(fid);104 fid=fopen([modelname '.outlog'],'w'); fclose(fid);105 end106 107 end108 %}}}109 function LaunchQueueJob(cluster,md,options)% {{{1110 111 %lauch command, to be executed via ssh112 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.runtimename ' && mkdir ' md.runtimename ...113 ' && cd ' md.runtimename ' && mv ../' md.runtimename '.tar.gz ./ && tar -zxf ' md.runtimename '.tar.gz && source ' md.name '.queue '];114 115 if ~strcmpi(options.batch,'yes'),116 117 %compress the files into one zip.118 compressstring=['tar -zcf ' md.runtimename '.tar.gz ' md.name '.bin ' md.name '.queue ' md.name '.petsc '];119 if md.qmu_analysis,120 compressstring=[compressstring md.name '.qmu.in'];121 end122 if cluster.interactive,123 compressstring=[compressstring ' ' md.name '.errlog ' md.name '.outlog '];124 end125 system(compressstring);126 127 disp('uploading input file and queueing script');128 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.runtimename '.tar.gz']});129 130 disp('launching solution sequence on remote cluster');131 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);132 else133 disp('batch mode requested: not launching job interactively');134 disp('launch solution sequence on remote cluster by hand');135 end136 137 end %}}}138 function Download(cluster,md)% {{{1139 140 %some check141 if isempty(md.runtimename),142 error('pfe Download error message: supply runtime name for results to be loaded!');143 end144 145 %Figure out the directory where all the files are in:146 directory=[cluster.executionpath '/' md.runtimename '/'];147 148 %What packages are we picking up from remote cluster149 packages={[md.name '.outlog'],[md.name '.errlog']};150 if md.qmu_analysis,151 packages{end+1}=[md.name '.qmu.err'];152 packages{end+1}=[md.name '.qmu.out'];153 if isfield(md.qmu_params,'tabular_graphics_data'),154 if md.qmu_params.tabular_graphics_data==true,155 packages{end+1}='dakota_tabular.dat';156 end157 end158 else159 packages{end+1}=[md.name '.outbin'];160 end161 162 %copy files from cluster to present directory163 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);164 end %}}}165 36 end 166 37 end -
issm/trunk/src/m/classes/clusters/generic.m
r8583 r8586 1 % ASTRIDclass definition1 %GENERIC cluster class definition 2 2 % 3 3 % Usage: 4 % cluster=generic( );5 % cluster=generic('n p',3);6 % cluster=generic('n p',3,'name','astrid','login','username');4 % cluster=generic('name','astrid',); 5 % cluster=generic('name','astrid','np',3); 6 % cluster=generic('name',oshostname(),'np',3,'login','username'); 7 7 8 8 classdef generic 9 9 properties (SetAccess=public) 10 10 % {{{1 11 name= oshostname();11 name=''; 12 12 login=''; 13 np= feature('numcores');13 np=1; 14 14 port=0; 15 15 interactive=1; … … 23 23 methods 24 24 function cluster=generic(varargin) % {{{1 25 25 26 %use provided options to change fields 27 options=pairoptions(varargin{:}); 28 29 %get name 30 if ~exist(options,'name'), error('option ''name'' has not been provided'); end 31 cluster.name=getfieldvalue(options,'name'); 32 26 33 %initialize cluster using user settings if provided 27 34 if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end 28 35 29 %use provided options to change fields 30 options=pairoptions(varargin{:}); 36 %OK get other fields 31 37 for i=1:size(options.list,1), 32 38 fieldname=options.list{i,1}; … … 55 61 %}}} 56 62 function IsConsistent(cluster) % {{{1 57 if cluster.np >feature('numcores'),58 error(['number of processors exceeds number of cores seen by matlab ' num2str(feature('numcores'))]);63 if cluster.np<1 64 error(['number of processors should be at least 1']); 59 65 end 60 66 if isnan(cluster.np),
Note:
See TracChangeset
for help on using the changeset viewer.