Changeset 804
- Timestamp:
- 06/04/09 18:08:18 (16 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/DataSet/DataSet.cpp
r688 r804 66 66 /*Call echo on object: */ 67 67 (*object)->Echo(); 68 69 } 70 return; 71 } 72 73 #undef __FUNCT__ 74 #define __FUNCT__ "DataSet::DeepEcho" 75 76 void DataSet::DeepEcho(){ 77 78 79 vector<Object*>::iterator object; 80 81 if(this==NULL)throw ErrorException(__FUNCT__," trying to echo a NULL dataset"); 82 83 _printf_("DataSet echo: %i objects\n",objects.size()); 84 85 for ( object=objects.begin() ; object < objects.end(); object++ ){ 86 87 /*Call deep echo on object: */ 88 (*object)->DeepEcho(); 68 89 69 90 } -
issm/trunk/src/c/DataSet/DataSet.h
r659 r804 37 37 int GetEnum(); 38 38 void Echo(); 39 void DeepEcho(); 39 40 char* Marshall(); 40 41 int MarshallSize(); -
issm/trunk/src/c/parallel/DakotaResponses.cpp
r659 r804 182 182 if(my_rank==0)responses[i]=max_abs_vz; 183 183 } 184 else throw ErrorException(__FUNCT__,exprintf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!")); 184 else{ 185 if(my_rank==0)printf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!"); 186 throw ErrorException(__FUNCT__,exprintf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!")); 187 } 185 188 } 186 189 -
issm/trunk/src/c/parallel/SpawnCore.cpp
r765 r804 19 19 #include "../include/macros.h" 20 20 21 void SpawnCore(double* responses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type ){21 void SpawnCore(double* responses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type,int counter){ 22 22 23 23 int i; … … 33 33 double* qmu_part=NULL; 34 34 int qmu_npart; 35 int debug=0; 35 36 36 37 extern int my_rank; … … 39 40 /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */ 40 41 MPI_Barrier(MPI_COMM_WORLD); 41 42 43 /*some parameters needed: */ 44 femmodels[0].parameters->FindParam((void*)&debug,"debug"); 45 42 46 /*First off, recover the response descriptors for the response functions: */ 43 47 param=(Param*)femmodels[0].parameters->FindParamObject("responsedescriptors"); … … 92 96 93 97 94 _printf_("initialize results:\n"); 98 99 if(debug)_printf_("Iteration: %i\n",counter); 100 101 //initialize results: 95 102 results=new DataSet(ResultsEnum()); 96 103 97 104 /*Modify core inputs to reflect the dakota variables inputs: */ 98 105 inputs->UpdateFromDakota(variables,variables_descriptors,numvariables,femmodels[0].parameters,qmu_part,qmu_npart); //femmodel #0 is the one holding the parameters for Dakota. 99 100 106 101 107 /*Run the analysis core solution sequence, with the updated inputs: */ 102 108 if(analysis_type==DiagnosticAnalysisEnum()){ 103 109 104 _printf_("Starting diagnostic core\n"); 110 if(debug)_printf_("Starting diagnostic core\n"); 111 105 112 diagnostic_core(results,femmodels,inputs); 106 113 … … 108 115 else if(analysis_type==ThermalAnalysisEnum()){ 109 116 110 _printf_("Starting thermal core\n");117 if(debug)_printf_("Starting thermal core\n"); 111 118 thermal_core(results,femmodels,inputs); 112 119 … … 114 121 else if(analysis_type==PrognosticAnalysisEnum()){ 115 122 116 _printf_("Starting prognostic core\n");123 if(debug)_printf_("Starting prognostic core\n"); 117 124 prognostic_core(results,femmodels,inputs); 118 125 … … 120 127 else if(analysis_type==TransientAnalysisEnum()){ 121 128 122 _printf_("Starting transient core\n");129 if(debug)_printf_("Starting transient core\n"); 123 130 throw ErrorException(__FUNCT__,"not supported yet!"); 124 131 … … 129 136 130 137 /*Now process the outputs, before computing the dakota responses: */ 131 _printf_("process results:\n");138 if(debug)_printf_("process results:\n"); 132 139 ProcessResults(&results,femmodels,analysis_type); 133 140 134 141 135 142 /*compute responses on cpu 0: dummy for now! */ 136 _printf_("compute dakota responses:\n");143 if(debug)_printf_("compute dakota responses:\n"); 137 144 DakotaResponses(responses,responses_descriptors,numresponses,femmodels,results,analysis_type,sub_analysis_type); 138 145 -
issm/trunk/src/c/parallel/diagnostic.cpp
r732 r804 103 103 /*run qmu analysis: */ 104 104 _printf_("calling qmu analysis on diagnostic core:\n"); 105 105 106 106 #ifdef _HAVE_DAKOTA_ 107 107 qmu(qmuinname,qmuoutname,qmuerrname,&femmodels[0],inputs,DiagnosticAnalysisEnum(),NoneAnalysisEnum()); -
issm/trunk/src/c/parallel/parallel.h
r667 r804 39 39 //int BatchDebug(Mat* Kgg,Vec* pg,FemModel* femmodel,char* filename); 40 40 void qmu(const char* dakota_input_file,const char* dakota_output_file,const char* dakota_error_file,FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type); 41 void SpawnCore(double* responses,double* variables,char** variable_descriptors,int numvariables, FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type );41 void SpawnCore(double* responses,double* variables,char** variable_descriptors,int numvariables, FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type,int counter); 42 42 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodels, DataSet* results,int analysis_type,int sub_analysis_type); 43 43 void ProcessResults(DataSet** presults,FemModel* fems,int analysis_type); -
issm/trunk/src/c/parallel/qmu.cpp
r662 r804 46 46 problem_db.manage_inputs(dakota_input_file); 47 47 // specify_outputs_restart() is only necessary if specifying non-defaults 48 parallel_lib.specify_outputs_restart(dakota_output_file,dakota_error_file,NULL, 48 parallel_lib.specify_outputs_restart(dakota_output_file,dakota_error_file,NULL,NULL); 49 49 50 50 // Instantiate the Strategy object (which instantiates all Model and … … 79 79 for(;;){ 80 80 81 SpawnCore(NULL,NULL,NULL,0,femmodels,inputs,analysis_type,sub_analysis_type );81 SpawnCore(NULL,NULL,NULL,0,femmodels,inputs,analysis_type,sub_analysis_type,0); 82 82 83 83 //Figure out if cpu 0 is done iterating -
issm/trunk/src/m/classes/@model/model.m
r765 r804 262 262 md.qmu_method=struct(); 263 263 md.qmu_params=struct(); 264 md.dakotaplugin=0; 264 265 md.dakotaresults=struct(); 265 266 md.dakotain=''; … … 267 268 md.dakotadat=''; 268 269 md.qmu_analysis=0; 269 md.iresp=1;270 md.ivar=1;271 270 md.npart=0; 272 271 -
issm/trunk/src/m/classes/public/LaunchQueueJobGeneric.m
r659 r804 21 21 if strcmpi(hostname,md.cluster), 22 22 if md.qmu_analysis, 23 system(['cp ' md.name '.bin' ' ' md.name '.queue qmu/' md.name '.qmu.in ' ' ' executionpath]);23 system(['cp ' md.name '.bin' ' ' md.name '.queue ' md.name '.qmu.in ' ' ' executionpath]); 24 24 else 25 25 system(['cp ' md.name '.bin' ' ' md.name '.queue' ' ' executionpath]); … … 27 27 else 28 28 if md.qmu_analysis, 29 system(['scp ' md.name '.bin' ' ' md.name '.queue qmu/' md.name '.qmu.in ' ' ' md.cluster ':' executionpath]);29 system(['scp ' md.name '.bin' ' ' md.name '.queue ' md.name '.qmu.in ' ' ' md.cluster ':' executionpath]); 30 30 else 31 31 system(['scp ' md.name '.bin' ' ' md.name '.queue' ' ' md.cluster ':' executionpath]); -
issm/trunk/src/m/classes/public/displayqmu.m
r765 r804 85 85 if isempty(md.dakotadat), disp(sprintf(' dakotadat: N/A')); else disp(sprintf(' dakotadat: [%ix%i] (can be accessed by typing md.dakotadat)',size(md.dakotadat)));end 86 86 disp(sprintf(' npart : %i (number of partitions for semi-descrete qmu)',md.npart)); 87 disp(sprintf(' dakotaplugin : %i (are we running using the library mode for Dakota? defaults to 0',md.dakotaplugin)); -
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r802 r804 67 67 'tolx','np','eps_rel','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 68 68 for i=1:length(fields), 69 if ~isempty( md.(fields{i})),70 if any(isnan( md.(fields{i}))),69 if ~isempty(eval(['md.' fields{i}])), 70 if any(isnan(eval(['md.' fields{i}]))), 71 71 disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']); 72 72 bool=0; return; … … 80 80 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 81 81 for i=1:length(fields), 82 if ~isempty( md.(fields{i})),83 if any( md.(fields{i})<0),82 if ~isempty(eval(['md.' fields{i}])), 83 if any((eval(['md.' fields{i}]))<0), 84 84 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 85 85 bool=0; return; … … 97 97 'sparsity','deltaH','DeltaH','timeacc','timedec'}; 98 98 for i=1:length(fields), 99 if ~isempty( md.(fields{i})),100 if any( md.(fields{i})==0),99 if ~isempty(eval(['md.' fields{i}])), 100 if any((eval(['md.' fields{i}]))==0), 101 101 disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']); 102 102 bool=0; return; … … 108 108 fields={'elements','p','q','elementoniceshelf','n','elementonbed'}; 109 109 for i=1:size(fields,2), 110 if (size( md.(fields{i}),1)~=md.numberofelements),110 if (size(eval(['md.' fields{i}]),1)~=md.numberofelements), 111 111 disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofelements) '!']); 112 112 bool=0; return; … … 117 117 fields={'x','y','z','B','drag','gridondirichlet_diag','melting','accumulation','surface','thickness','bed','gridonbed','gridonsurface'}; 118 118 for i=1:length(fields), 119 if length( md.(fields{i}))~=md.numberofgrids,119 if length(eval(['md.' fields{i}]))~=md.numberofgrids, 120 120 disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']); 121 121 bool=0; return; … … 157 157 158 158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLUTION CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 159 %QMU 160 if md.dakotaplugin==1, 161 if md.qmu_params.evaluation_concurrency~=1, 162 disp(['concurrency should be set to 1 when running dakota in library mode']); 163 bool=0;return; 164 end 165 end 166 167 159 168 160 169 %DIAGNOSTIC … … 249 258 fields={'dt','ndt'}; 250 259 for i=1:length(fields), 251 if any( md.(fields{i})<0),260 if any((eval(['md.' fields{i}]))<0), 252 261 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 253 262 bool=0; return; … … 320 329 fields={'vx_obs','vy_obs'}; 321 330 for i=1:length(fields), 322 if any(length( md.(fields{i}))~=md.numberofgrids),331 if any(length(eval(['md.' fields{i}]))~=md.numberofgrids), 323 332 disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']); 324 333 bool=0; return; … … 362 371 fields={'sparsity'}; 363 372 for i=1:length(fields), 364 if ~isempty( md.(fields{i})),365 if any(isnan( md.(fields{i}))),373 if ~isempty(eval(['md.' fields{i}])), 374 if any(isnan(eval(['md.' fields{i}]))), 366 375 disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']); 367 376 bool=0; return; … … 373 382 fields={'sparsity'}; 374 383 for i=1:length(fields), 375 if ~isempty( md.(fields{i})),376 if any( md.(fields{i})<0),384 if ~isempty(eval(['md.' fields{i}])), 385 if any((eval(['md.' fields{i}]))<0), 377 386 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 378 387 bool=0; return; … … 384 393 fields={'sparsity'}; 385 394 for i=1:length(fields), 386 if ~isempty( md.(fields{i})),387 if any( md.(fields{i})==0),395 if ~isempty(eval(['md.' fields{i}])), 396 if any((eval(['md.' fields{i}]))==0), 388 397 disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']); 389 398 bool=0; return; … … 435 444 fields={'time','np'}; 436 445 for i=1:length(fields), 437 if ~isempty( md.(fields{i})),438 if any(isnan( md.(fields{i}))),446 if ~isempty(eval(['md.' fields{i}])), 447 if any(isnan(eval(['md.' fields{i}]))), 439 448 disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']); 440 449 bool=0; return; … … 446 455 fields={'time','np'}; 447 456 for i=1:length(fields), 448 if ~isempty( md.(fields{i})),449 if any( md.(fields{i})<0),457 if ~isempty(eval(['md.' fields{i}])), 458 if any((eval(['md.' fields{i}]))<0), 450 459 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 451 460 bool=0; return; … … 457 466 fields={'time','np'}; 458 467 for i=1:length(fields), 459 if ~isempty( md.(fields{i})),460 if any( md.(fields{i})==0),468 if ~isempty(eval(['md.' fields{i}])), 469 if any((eval(['md.' fields{i}]))==0), 461 470 disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']); 462 471 bool=0; return; -
issm/trunk/src/m/classes/public/loadresultsfromcluster.m
r672 r804 17 17 %Go pickup output file and logs on cluster 18 18 if strcmpi(hostname,md.cluster), 19 system(['cp ' executionpath '/' md.name '.*o* ./']); %get outlog, errlog and outbin files 19 if md.qmu_analysis, 20 system(['cp ' executionpath '/' md.name '.outlog ' executionpath '/' md.name '.errlog ' executionpath '/' md.name '.outbin ' executionpath '/' md.name '.qmu.err ' executionpath '/' md.name '.qmu.out ' executionpath '/dakota_tabular.dat ./']); %get outlog, errlog and outbin files 21 else 22 system(['cp ' executionpath '/' md.name '.outlog ' executionpath '/' md.name '.errlog ' executionpath '/' md.name '.outbin ./']); %get outlog, errlog and outbin files 23 end 20 24 else 21 system(['scp ' md.cluster ':' executionpath '/' md.name '.*o* ./']); %get outlog, errlog and outbin files 25 if md.qmu_analysis, 26 system(['scp ' md.cluster ':' executionpath '/' md.name '.outlog ' executionpath '/' md.name '.errlog ' executionpath '/' md.name '.outbin ' executionpath '/' md.name '.qmu.err ' executionpath '/' md.name '.qmu.out ' executionpath '/dakota_tabular.dat ./']); %get outlog, errlog and outbin files 27 else 28 system(['scp ' md.cluster ':' executionpath '/' md.name '.outlog ' executionpath '/' md.name '.errlog ' executionpath '/' md.name '.outbin ./']); %get outlog, errlog and outbin files 29 end 22 30 end 23 31 -
issm/trunk/src/m/classes/public/loadresultsfromdisk.m
r771 r804 12 12 13 13 %load result onto model 14 if isnan(md.results), md.results=struct(); end 14 if ~isstruct(md.results), 15 if isnan(md.results), md.results=struct(); end 16 end 15 17 eval(['md.results.' md.analysis_type '=parseresultsfromdisk(filename);']); 16 18 17 %Check result is consistent 18 disp(sprintf('%s\n','checking result consistency')); 19 if ~isresultconsistent(md,md.analysis_type), 20 %it would be very cruel to put an error, it would kill the computed results (even if not consistent...) 21 disp('!! results not consistent correct the model !!') 19 %Check result is consistent, only if it exists 20 if ~isempty(md.results.diagnostic), 21 disp(sprintf('%s\n','checking result consistency')); 22 if ~isresultconsistent(md,md.analysis_type), 23 %it would be very cruel to put an error, it would kill the computed results (even if not consistent...) 24 disp('!! results not consistent correct the model !!') 25 end 22 26 end 27 28 %deal with qmu results 29 if md.qmu_analysis, 30 md=qmuoutput(md,md.name,'qmu'); 31 end -
issm/trunk/src/m/classes/public/marshall.m
r765 r804 156 156 end 157 157 158 %Qmu 158 %Qmu: the rest will be handle by qmumarshall 159 159 WriteData(fid,md.qmu_analysis,'Integer','qmu_analysis'); 160 if md.qmu_analysis,161 %recover variables for corresponding analysis162 variables=md.variables(md.ivar);163 160 164 %count how many variables we have165 numvariables=0;166 variable_fieldnames=fieldnames(variables);167 for i=1:length(variable_fieldnames),168 field_name=variable_fieldnames{i};169 fieldvariables=variables.(field_name);170 numvariables=numvariables+numel(variables.(field_name));171 end172 %write number of variables to disk173 WriteData(fid,numvariables,'Integer','numberofvariables');174 175 %now, for each variable, write descriptor176 count=0;177 for i=1:length(variable_fieldnames),178 field_name=variable_fieldnames{i};179 fieldvariables=variables.(field_name);180 for j=1:length(fieldvariables),181 descriptor=fieldvariables(j).descriptor;182 WriteData(fid,descriptor,'String',['variabledescriptor' num2str(count)]);183 count=count+1;184 end185 end186 187 %deal with responses188 189 %recover responses for corresponding analysis190 responses=md.responses(md.iresp);191 192 %count how many responses we have193 numresponses=0;194 response_fieldnames=fieldnames(responses);195 for i=1:length(response_fieldnames),196 field_name=response_fieldnames{i};197 fieldresponses=responses.(field_name);198 numresponses=numresponses+numel(responses.(field_name));199 end200 %write number of responses to disk201 WriteData(fid,numresponses,'Integer','numberofresponses');202 203 %now, for each response, write descriptor204 count=0;205 for i=1:length(response_fieldnames),206 field_name=response_fieldnames{i};207 fieldresponses=responses.(field_name);208 for j=1:length(fieldresponses),209 descriptor=fieldresponses(j).descriptor;210 WriteData(fid,descriptor,'String',['responsedescriptor' num2str(count)]);211 count=count+1;212 end213 end214 215 216 %write npart to disk217 WriteData(fid,md.npart,'Integer','npart');218 end219 220 161 %Get penalties to connect collapsed and non-collapsed 3d meshes: 221 162 if strcmpi(md.type,'3d'),
Note:
See TracChangeset
for help on using the changeset viewer.