Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Diff of /trunk/gadget/simann.cc
[mareframe] / trunk / gadget / simann.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/simann.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 14, Thu Jul 30 12:36:46 2015 UTC revision 16, Tue Oct 13 11:29:01 2015 UTC
# Line 178  Line 178 
178  #include "ecosystem.h"  #include "ecosystem.h"
179  #include "global.h"  #include "global.h"
180  #include "seq_optimize_template.h"  #include "seq_optimize_template.h"
181  #ifdef GADGET_OPENMP  #ifdef SPECULATIVE
182  #include <omp.h>  #include <omp.h>
183  #endif  #endif
184    
185  extern Ecosystem* EcoSystem;  extern Ecosystem* EcoSystem;
186  #ifndef NO_OPENMP  #ifdef _OPENMP
187  extern Ecosystem** EcoSystems;  extern Ecosystem** EcoSystems;
188  #endif  #endif
189    
# Line 436  Line 436 
436  //}  //}
437    
438    
439  #ifdef GADGET_OPENMP  #ifdef SPECULATIVE
440  void OptInfoSimann::OptimiseLikelihoodOMP() {  void OptInfoSimann::OptimiseLikelihoodOMP() {
441    
442    //set initial values    //set initial values
# Line 805  Line 805 
805  /// Represents the function that computes how good the parameters are  /// Represents the function that computes how good the parameters are
806  double evaluate_f(const DoubleVector& params) {  double evaluate_f(const DoubleVector& params) {
807          double trialf;          double trialf;
808  #ifndef NO_OPENMP  #ifdef _OPENMP
809          int id = omp_get_thread_num ();          int id = omp_get_thread_num ();
810          trialf = EcoSystems[id]->SimulateAndUpdate(params);          trialf = EcoSystems[id]->SimulateAndUpdate(params);
811  #else  #else
# Line 1035  Line 1035 
1035          EcoSystem->resetVariables(); //JMB need to reset variables in case they have been scaled          EcoSystem->resetVariables(); //JMB need to reset variables in case they have been scaled
1036          if (scale) {          if (scale) {
1037                  EcoSystem->scaleVariables();                  EcoSystem->scaleVariables();
1038  #ifndef NO_OPENMP  #ifdef _OPENMP
1039                  int numThr = omp_get_max_threads ( );                  int numThr = omp_get_max_threads ( );
1040                  for(i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread                  for(i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread
1041                          EcoSystems[i]->scaleVariables();                          EcoSystems[i]->scaleVariables();
# Line 1087  Line 1087 
1087          ReproducibleSearch<Siman, DoubleVector, ControlClass, evaluate_f, buildNewParams_f>          ReproducibleSearch<Siman, DoubleVector, ControlClass, evaluate_f, buildNewParams_f>
1088          pa(s, x, simanniter);          pa(s, x, simanniter);
1089    
1090  #ifndef NO_OPENMP  #ifdef _OPENMP
1091          // OpenMP parallelization          // OpenMP parallelization
1092          int numThr = omp_get_max_threads ( );          int numThr = omp_get_max_threads ( );
1093          pa.paral_opt_omp(funcval,numThr,numThr);          pa.paral_opt_omp(funcval,numThr,numThr);

Legend:
Removed from v.14  
changed lines
  Added in v.16

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge