Changeset 4193
- Timestamp:
- 06/24/10 13:46:42 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r4168 r4193 1030 1030 ./modules/Qmux/Qmux.cpp\ 1031 1031 ./modules/Qmux/DakotaResponses.cpp\ 1032 ./modules/Qmux/DakotaMPI_Bcast.cpp\ 1032 1033 ./modules/Qmux/SpawnCore.cpp\ 1033 1034 ./modules/Qmux/SpawnCoreParallel.cpp\ -
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r4082 r4193 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void InputUpdateFromDakotax(double* variables,char** variables_descriptors,int numvariables,FemModel* femmodel,double* qmu_part,int qmu_npart){ 11 void InputUpdateFromDakotax(FemModel* femmodel, double* variables,char** variables_descriptors,int numvariables){ 12 13 /*retrieve parameters: */ 14 femmodel->parameters->FindParam(&verbose,VerboseEnum); 15 femmodel->parameters->FindParam(&qmu_npart,QmuNPartEnum); 16 femmodel->parameters->FindParam(&qmu_part,&dummy,QmuPartEnum); 17 18 12 19 13 20 ISSMERROR(" not supported yet!"); -
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h
r4082 r4193 9 9 #include "../../DataSet/DataSet.h" 10 10 11 12 void InputUpdateFromDakotax(double* variables,char** variables_descriptors,int numvariables,FemModel* femmodel,double* qmu_part,int qmu_npart); 11 void InputUpdateFromDakotax(FemModel* femmodel,double* variables,char** variables_descriptors,int numvariables); 13 12 14 13 #endif /* _INPUTUPDATEFROMDAKOTAXX_H */ -
issm/trunk/src/c/modules/Qmux/Qmux.cpp
r4042 r4193 50 50 #endif 51 51 52 #ifdef _SERIAL_ 53 void Qmux(mxArray* femmodel,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file){ 54 #else 55 void Qmux(FemModel* femmodel){ 56 #endif 52 void Qmux(void* femmodel,Parameters* parameters){ //void* for femmodel, because we do not use it, just pass it along 57 53 58 54 59 55 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in. 60 61 #ifdef _PARALLEL_ 62 char* dakota_input_file=NULL; 63 char* dakota_output_file=NULL; 64 char* dakota_error_file=NULL; 65 extern int my_rank; 66 #endif 67 int status=0; 56 57 extern int my_rank; 58 char* dakota_input_file = NULL; 59 char* dakota_output_file = NULL; 60 char* dakota_error_file = NULL; 61 int status=0; 68 62 Dakota::ModelLIter ml_iter; 69 63 70 #ifdef _PARALLEL_71 64 /*Recover dakota_input_file, dakota_output_file and dakota_error_file, in the parameters dataset in parallel */ 72 model->FindParam(&dakota_input_file,QmuInNameEnum); 73 model->FindParam(&dakota_output_file,QmuOutNameEnum); 74 model->FindParam(&dakota_error_file,QmuErrNameEnum); 75 #endif 65 parameters->FindParam(&dakota_input_file,QmuInNameEnum); 66 parameters->FindParam(&dakota_output_file,QmuOutNameEnum); 67 parameters->FindParam(&dakota_error_file,QmuErrNameEnum); 76 68 77 69 #ifdef _PARALLEL_ … … 131 123 } 132 124 } 133 #endif 125 #endif //#ifdef _PARALLEL_ 134 126 135 127 /*Free ressources:*/ 136 #ifdef _PARALLEL_137 128 xfree((void**)&dakota_input_file); 138 129 xfree((void**)&dakota_error_file); 139 130 xfree((void**)&dakota_output_file); 140 #endif141 131 142 143 #endif 144 132 #endif //#ifdef _HAVE_DAKOTA_ 145 133 } -
issm/trunk/src/c/modules/Qmux/Qmux.h
r4043 r4193 9 9 #include "../../objects/objects.h" 10 10 11 void Qmux(void* femmodel,Parameters* parameters); 12 11 13 /* local prototypes: */ 12 14 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter); 15 13 16 #ifdef _SERIAL_ 14 void Qmux(mxArray* femmodel,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file);15 17 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int counter); 16 18 #else 17 void Qmux(FemModel* femmodel);18 19 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter); 19 20 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel); 21 void DakotaMPI_Bcast(double** pvariables, char*** pvariables_descriptors,int* pnumvariables, int* pnumresponses); 20 22 #endif 21 23 22 23 24 #endif /* _QMUX_H */ 24 -
issm/trunk/src/c/modules/Qmux/SpawnCore.cpp
r4043 r4193 20 20 21 21 /*Branch into a serial SpawnCore and a parallel SpawnCore: */ 22 22 23 #ifdef _SERIAL_ 23 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);24 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter); 24 25 #else 25 /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */ 26 MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD); if(counter==-1)return 0; 27 28 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel,counter); 26 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); 29 if(counter==-1)return 0; 30 31 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel,counter); 29 32 #endif 30 33 -
issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp
r4082 r4193 41 41 42 42 char **responses_descriptors = NULL; 43 int num_responses_descriptors;44 43 char *string = NULL; 45 44 int string_length; … … 50 49 int solution_type; 51 50 52 53 54 51 /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */ 55 52 MPI_Barrier(MPI_COMM_WORLD); 53 _printf_("qmu iteration: %i\n",counter); 56 54 57 /* some parameters needed: */55 /*retrieve parameters: */ 58 56 femmodel->parameters->FindParam(&verbose,VerboseEnum); 57 femmodel->parameters->FindParam(&responses_descriptors,&dummy,ResponseDescriptorsEnum); 58 if(dummy!=numresponses)ISSMERROR(" parameter numresponses not equal to Dakota provided numresponses: %i vs %i\n",dummy,numresponses); 59 60 /* only cpu 0, running dakota is providing us with variables, variables_descriptors and responses. 61 * broadcast onto other cpus: */ 62 DakotaMPI_Bcast(&variables,&variables_descriptors,&numvariables,&numresponses); 63 64 /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */ 65 InputUpdateFromDakotax(femmodel,variables,variables_descriptors,numvariables); 66 67 /*Run the analysis core solution sequence: */ 59 68 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 60 61 /*Recover partitioning for dakota: */ 62 femmodel->parameters->FindParam(&qmu_npart,QmuNPartEnum); 63 femmodel->parameters->FindParam(&qmu_part,&dummy,QmuPartEnum); 64 65 /*broadcast variables: only cpu 0 has correct values*/ 66 MPI_Bcast(&numvariables,1,MPI_INT,0,MPI_COMM_WORLD); 67 if(my_rank!=0)variables=(double*)xmalloc(numvariables*sizeof(double)); 68 MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,MPI_COMM_WORLD); 69 70 /*broadcast variables_descriptors: */ 71 if(my_rank!=0){ 72 variables_descriptors=(char**)xmalloc(numvariables*sizeof(char*)); 73 } 74 for(i=0;i<numvariables;i++){ 75 if(my_rank==0){ 76 string=variables_descriptors[i]; 77 string_length=(strlen(string)+1)*sizeof(char); 78 } 79 MPI_Bcast(&string_length,1,MPI_INT,0,MPI_COMM_WORLD); 80 if(my_rank!=0)string=(char*)xmalloc(string_length); 81 MPI_Bcast(string,string_length,MPI_CHAR,0,MPI_COMM_WORLD); 82 if(my_rank!=0)variables_descriptors[i]=string; 69 if(verbose)_printf_("%s%s%s\n","Starting ",EnumAsString(solution_type)," core:"); 70 switch(solution_type){ 71 case DiagnosticAnalysisEnum: 72 diagnostic_core(femmodel); 73 break; 74 case ThermalAnalysisEnum: 75 thermal_core(femmodel); 76 break; 77 case PrognosticAnalysisEnum: 78 prognostic_core(femmodel); 79 break; 80 case Transient2DAnalysisEnum: 81 transient2d_core(femmodel); 82 break; 83 case Transient3DAnalysisEnum: 84 transient3d_core(femmodel); 85 default: 86 ISSMERROR("%s%s%s"," solution_type: ",EnumAsString(solution_type),", not supported yet!"); 87 break; 83 88 } 84 89 85 /*broadcast numresponses: */86 MPI_Bcast(&numresponses,1,MPI_INT,0,MPI_COMM_WORLD);87 88 _printf_("qmu iteration: %i\n",counter);89 90 /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */91 InputUpdateFromDakotax(variables,variables_descriptors,numvariables,femmodel,qmu_part,qmu_npart);92 93 /*Run the analysis core solution sequence: */94 if(solution_type==DiagnosticAnalysisEnum){95 96 if(verbose)_printf_("Starting diagnostic core\n");97 98 diagnostic_core(femmodel);99 100 }101 else if(solution_type==ThermalAnalysisEnum){102 103 if(verbose)_printf_("Starting thermal core\n");104 thermal_core(femmodel);105 106 }107 else if(solution_type==PrognosticAnalysisEnum){108 109 if(verbose)_printf_("Starting prognostic core\n");110 prognostic_core(femmodel);111 112 }113 else if(solution_type==Transient2DAnalysisEnum){114 115 if(verbose)_printf_("Starting transient core\n");116 transient2d_core(femmodel);117 118 }119 else if(solution_type==Transient3DAnalysisEnum){120 121 if(verbose)_printf_("Starting transient core\n");122 transient3d_core(femmodel);123 124 }125 else ISSMERROR("%s%s%s"," solution_type: ",EnumAsString(solution_type),", not supported yet!");126 127 90 /*compute responses on cpu 0: dummy for now! */ 128 91 if(verbose)_printf_("compute dakota responses:\n"); 129 92 DakotaResponses(responses,responses_descriptors,numresponses,femmodel); 130 93 131 /*Free ressources: */94 /*Free ressources:{{{1*/ 132 95 //variables only on cpu != 0 133 96 if(my_rank!=0){ … … 147 110 xfree((void**)&responses_descriptors); 148 111 xfree((void**)&qmu_part); 149 150 112 /*}}}*/ 151 113 } 152 114 -
issm/trunk/src/m/solutions/NewFemModel.m
r4188 r4193 18 18 displaystring(md.verbose,'\n reading data from model %s...',md.name); 19 19 [femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.constraints,femmodel.loads,femmodel.materials,femmodel.parameters]=ModelProcessor(md,solution_type,femmodel.analysis_type_list); 20 20 21 21 %Initialize some fiels with empty celils 22 22 femmodel.m_yg=cell(nummodels,1); -
issm/trunk/src/m/solutions/SpawnCore.m
r4131 r4193 1 function responses=SpawnCore( models,variables,variabledescriptors,counter);1 function responses=SpawnCore(femmodel,variables,variabledescriptors,counter); 2 2 %SPAWNCORE - for Qmu analysis, using Dakota. Spawn the core solution. 3 3 % 4 4 % Usage: 5 % responses=SpawnCore( models,variables,variabledescriptors)5 % responses=SpawnCore(femmodel,variables,variabledescriptors) 6 6 % 7 7 8 8 %recover parameters 9 verbose=models.dh.parameters.Verbose; 10 parameters=models.dh.parameters; 11 responsedescriptors=models.dh.parameters.responsedescriptors; 12 npart=models.dh.parameters.qmu_npart; 13 part=models.dh.parameters.qmu_part+1; %C indexing 14 numberofnodes=models.dh.parameters.NumberOfNodes; 9 verbose=femmodel.parameters.Verbose; 10 responsedescriptors=femmodel.parameters.responsedescriptors; 11 npart=femmodel.parameters.qmu_npart; 12 part=femmodel.parameters.qmu_part+1; %C indexing 13 numberofnodes=femmodel.parameters.NumberOfNodes; 15 14 16 disp ([' qmu iteration: ',num2str(counter)]);15 displaystring(verbose,'%s%i',[' qmu iteration:'],counter); 17 16 18 %first update the inputs to the modelsusing the variables provided to us by dakota.17 %first update the inputs to the femmodel using the variables provided to us by dakota. 19 18 count=1; 20 19 while count<=numel(variables) … … 27 26 else 28 27 root=qmuroot(descriptor); 29 param= parameters.(root);28 param=femmodel.parameters.(root); 30 29 31 30 %next npart values in variables are partition values for this param, collect them. … … 47 46 if analysis_type==DiagnosticAnalysisEnum(), 48 47 49 results=diagnostic_core( models);48 results=diagnostic_core(femmodel); 50 49 51 50 else … … 54 53 55 54 %process results 56 processedresults=processresults( models,results);55 processedresults=processresults(femmodel,results); 57 56 58 57 %now process the results to get response function values … … 60 59 for i=1:numel(responsedescriptors), 61 60 descriptor=responsedescriptors{i}; 62 responses(i)=qmuresponse( models,results,processedresults,descriptor);61 responses(i)=qmuresponse(femmodel,results,processedresults,descriptor); 63 62 end -
issm/trunk/src/m/solutions/bedslope.m
r4184 r4193 28 28 else 29 29 %launch dakota driver for diagnostic core solution 30 Qmu(femmodel );30 Qmu(femmodel,femmodel.parameters); 31 31 end 32 32 -
issm/trunk/src/m/solutions/diagnostic.m
r4184 r4193 37 37 else 38 38 %launch dakota driver for diagnostic core solution 39 Qmu(femmodel );39 Qmu(femmodel,femmodel.parameters); 40 40 end 41 41 -
issm/trunk/src/m/solutions/prognostic.m
r4184 r4193 28 28 else 29 29 %launch dakota driver for diagnostic core solution 30 Qmu(femmodel );30 Qmu(femmodel,femmodel.parameters); 31 31 end 32 32 -
issm/trunk/src/m/solutions/prognostic2.m
r4184 r4193 27 27 else 28 28 %launch dakota driver for diagnostic core solution 29 Qmu(femmodel );29 Qmu(femmodel,femmodel.parameters); 30 30 end 31 31 -
issm/trunk/src/m/solutions/surfaceslope.m
r4184 r4193 28 28 else 29 29 %launch dakota driver for diagnostic core solution 30 Qmu(femmodel );30 Qmu(femmodel,femmodel.parameters); 31 31 end 32 32 -
issm/trunk/src/m/solutions/transient2d.m
r4184 r4193 27 27 else 28 28 %launch dakota driver for diagnostic core solution 29 Qmu(femmodel );29 Qmu(femmodel,femmodel.parameters); 30 30 end 31 31 -
issm/trunk/src/m/solutions/transient3d.m
r4184 r4193 26 26 else 27 27 %launch dakota driver for diagnostic core solution 28 Qmu(femmodel );28 Qmu(femmodel,femmodel.parameters); 29 29 end 30 30 -
issm/trunk/src/mex/Qmu/Qmu.cpp
r4103 r4193 14 14 15 15 /*diverse: */ 16 int noerr=1;16 int noerr = 1; 17 17 18 18 /*input datasets: */ 19 mxArray* femmodel=NULL; 20 mxArray* parameters=NULL; 21 char* dakota_input_file=NULL; 22 char* dakota_output_file=NULL; 23 char* dakota_error_file=NULL; 19 mxArray *femmodel = NULL; 20 Parameters *parameters = NULL; 24 21 25 22 /* output datasets: none*/ … … 38 35 femmodel=FEMMODEL; 39 36 40 /*get parameters from femmodel structure: */ 41 parameters=mxGetField(FEMMODEL,0,"parameters"); 42 43 FetchData(&dakota_input_file,mxGetField(parameters,0,"qmuinname")); 44 FetchData(&dakota_output_file,mxGetField(parameters,0,"qmuoutname")); 45 FetchData(&dakota_error_file,mxGetField(parameters,0,"qmuerrname")); 37 /*Fetch parameters from femmodel structure: */ 38 FetchData(¶meters,PARAMETERS); 46 39 47 40 /*!Generate internal degree of freedom numbers: */ 48 Qmux(femmodel,dakota_input_file,dakota_output_file,dakota_error_file); 49 50 /*Free ressources:*/ 51 xfree((void**)&dakota_input_file); 52 xfree((void**)&dakota_output_file); 53 xfree((void**)&dakota_error_file); 41 Qmux(femmodel,parameters); 54 42 55 43 /*end module: */
Note:
See TracChangeset
for help on using the changeset viewer.