Changeset 2048
- Timestamp:
- 08/28/09 14:43:25 (16 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Qmux/Qmux.cpp
r1881 r2048 125 125 126 126 #ifdef _PARALLEL_ 127 //Warn other cpus that we are done running the dakota iterator 128 MPI_Bcast(&status,1,MPI_INT,0,MPI_COMM_WORLD);127 //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1: 128 SpawnCore(NULL,0, NULL,NULL,0,model,inputs,analysis_type,sub_analysis_type,-1); 129 129 #endif 130 130 131 #ifdef _PARALLEL_ 131 132 } … … 133 134 134 135 for(;;){ 135 136 SpawnCore(NULL,0, NULL,NULL,0,model,inputs,analysis_type,sub_analysis_type,0); 137 138 //Figure out if cpu 0 is done iterating 139 MPI_Bcast(&status,1,MPI_INT,0,MPI_COMM_WORLD); 140 141 //yes! 142 if(status){ 143 break; //yes, we are done 144 } 145 else{ 146 /*We are not done: */ 147 148 149 } 136 if(!SpawnCore(NULL,0, NULL,NULL,0,model,inputs,analysis_type,sub_analysis_type,0))break; //counter came in at -1 on cpu0, bail out. 150 137 } 151 152 153 138 } 154 139 #endif -
issm/trunk/src/c/Qmux/Qmux.h
r1842 r2048 9 9 10 10 /* local prototypes: */ 11 voidSpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,void* inputs,int analysis_type,int sub_analysis_type,int counter);11 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,void* inputs,int analysis_type,int sub_analysis_type,int counter); 12 12 #ifdef _SERIAL_ 13 13 void Qmux(mxArray* model,mxArray* inputs,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file); -
issm/trunk/src/c/Qmux/SpawnCore.cpp
r1842 r2048 19 19 #include "../include/macros.h" 20 20 21 void SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,void* inputs,int analysis_type,int sub_analysis_type,int counter){ 22 21 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,void* inputs,int analysis_type,int sub_analysis_type,int counter){ 23 22 24 23 /*Branch into a serial SpawnCore and a parallel SpawnCore: */ … … 26 25 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)model, (mxArray*)inputs,analysis_type,sub_analysis_type,counter); 27 26 #else 27 /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */ 28 MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD); if(counter==-1)return 0; 29 28 30 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (Model*)model, (ParameterInputs*)inputs,analysis_type,sub_analysis_type,counter); 29 31 #endif 30 32 31 33 return 1; 32 34 } -
issm/trunk/src/c/objects/DakotaPlugin.cpp
r1843 r2048 59 59 int DakotaPlugin::derived_map_ac(const Dakota::String& driver) { 60 60 61 int status=0;62 61 int i; 63 62 double* variables=NULL; … … 98 97 } 99 98 100 #ifdef _PARALLEL_101 /*warn other cpus that we are done running this iteration: */102 MPI_Bcast(&status,1,MPI_INT,0,MPI_COMM_WORLD);103 #endif104 99 105 100 /*Free ressources:*/ -
issm/trunk/src/c/parallel/diagnostic.cpp
r2020 r2048 117 117 control_core(results,model,inputs); 118 118 } 119 if(!control_analysis){ 120 /*Add analysis_type to results: */ 121 result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic"); 122 results->AddObject(result); 123 124 _printf_("process results:\n"); 125 ProcessResults(&results,model,DiagnosticAnalysisEnum()); 126 } 127 else{ 128 /*Add analysis_type and control_type to results: */ 129 result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic"); 130 results->AddObject(result); 131 132 model->FindParam(&control_type,"control_type"); 133 result=new Result(results->Size()+1,0,1,"control_type",control_type); 134 results->AddObject(result); 135 136 _printf_("process results:\n"); 137 ProcessResults(&results,model,ControlAnalysisEnum()); 138 } 139 140 _printf_("write results to disk:\n"); 141 OutputResults(results,outputfilename); 119 142 } 120 143 else{ … … 129 152 } 130 153 131 if(!control_analysis){132 /*Add analysis_type to results: */133 result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");134 results->AddObject(result);135 136 _printf_("process results:\n");137 ProcessResults(&results,model,DiagnosticAnalysisEnum());138 }139 else{140 /*Add analysis_type and control_type to results: */141 result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");142 results->AddObject(result);143 144 model->FindParam(&control_type,"control_type");145 result=new Result(results->Size()+1,0,1,"control_type",control_type);146 results->AddObject(result);147 148 _printf_("process results:\n");149 ProcessResults(&results,model,ControlAnalysisEnum());150 }151 152 _printf_("write results to disk:\n");153 OutputResults(results,outputfilename);154 155 154 _printf_("write lock file:\n"); 156 155 if (waitonlock){ 157 156 WriteLockFile(lockname); 158 157 } 159 158 160 159 _printf_("closing MPI and Petsc\n"); 161 160 PetscFinalize(); -
issm/trunk/src/c/parallel/steadystate.cpp
r2033 r2048 135 135 control_core(results,model,inputs); 136 136 } 137 138 if(!control_analysis){ 139 /*Add analysis_type to results: */ 140 result=new Result(results->Size()+1,0,1,"analysis_type","steadystate"); 141 results->AddObject(result); 142 143 _printf_("process results:\n"); 144 ProcessResults(&results,model,SteadystateAnalysisEnum()); 145 } 146 else{ 147 /*Add analysis_type and control_type to results: */ 148 result=new Result(results->Size()+1,0,1,"analysis_type","steadystate"); 149 results->AddObject(result); 150 151 model->FindParam(&control_type,"control_type"); 152 result=new Result(results->Size()+1,0,1,"control_type",control_type); 153 results->AddObject(result); 154 155 _printf_("process results:\n"); 156 ProcessResults(&results,model,ControlAnalysisEnum()); 157 } 158 159 _printf_("write results to disk:\n"); 160 OutputResults(results,outputfilename); 137 161 } 138 162 else{ … … 146 170 #endif 147 171 } 148 149 if(!control_analysis){150 /*Add analysis_type to results: */151 result=new Result(results->Size()+1,0,1,"analysis_type","steadystate");152 results->AddObject(result);153 154 _printf_("process results:\n");155 ProcessResults(&results,model,SteadystateAnalysisEnum());156 }157 else{158 /*Add analysis_type and control_type to results: */159 result=new Result(results->Size()+1,0,1,"analysis_type","steadystate");160 results->AddObject(result);161 162 model->FindParam(&control_type,"control_type");163 result=new Result(results->Size()+1,0,1,"control_type",control_type);164 results->AddObject(result);165 166 _printf_("process results:\n");167 ProcessResults(&results,model,ControlAnalysisEnum());168 }169 170 _printf_("write results to disk:\n");171 OutputResults(results,outputfilename);172 172 173 173 _printf_("write lock file:\n"); -
issm/trunk/src/c/parallel/thermal.cpp
r2012 r2048 99 99 thermal_core(results,model,inputs); 100 100 101 /*Add analysis_type to results: */ 102 result=new Result(results->Size()+1,0,1,"analysis_type","thermal"); 103 results->AddObject(result); 104 105 _printf_("process results:\n"); 106 ProcessResults(&results,model,ThermalAnalysisEnum()); 107 108 _printf_("write results to disk:\n"); 109 OutputResults(results,outputfilename); 101 110 } 102 111 else{ … … 110 119 #endif 111 120 } 112 113 /*Add analysis_type to results: */114 result=new Result(results->Size()+1,0,1,"analysis_type","thermal");115 results->AddObject(result);116 117 _printf_("process results:\n");118 ProcessResults(&results,model,ThermalAnalysisEnum());119 120 _printf_("write results to disk:\n");121 OutputResults(results,outputfilename);122 121 123 122 _printf_("write lock file:\n"); -
issm/trunk/src/c/parallel/transient.cpp
r2014 r2048 124 124 _printf_("call computational core:\n"); 125 125 transient_core(results,model,inputs); 126 127 /*Add analysis_type to results: */ 128 result=new Result(results->Size()+1,0,1,"analysis_type","transient"); 129 results->AddObject(result); 130 131 _printf_("process results:\n"); 132 ProcessResults(&results,model,TransientAnalysisEnum()); 133 134 _printf_("write results to disk:\n"); 135 OutputResults(results,outputfilename); 126 136 } 127 137 else{ … … 135 145 #endif 136 146 } 137 138 /*Add analysis_type to results: */139 result=new Result(results->Size()+1,0,1,"analysis_type","transient");140 results->AddObject(result);141 142 _printf_("process results:\n");143 ProcessResults(&results,model,TransientAnalysisEnum());144 145 _printf_("write results to disk:\n");146 OutputResults(results,outputfilename);147 148 147 _printf_("write lock file:\n"); 149 148 if (waitonlock){
Note:
See TracChangeset
for help on using the changeset viewer.