--- trunk/gadget/ecosystem.cc 2015/07/24 18:36:24 12 +++ trunk/gadget/ecosystem.cc 2015/11/09 10:22:57 17 @@ -1,19 +1,20 @@ #include "ecosystem.h" #include "runid.h" #include "global.h" -#ifndef NO_OPENMP +#ifdef _OPENMP #include #endif -#ifndef NO_OPENMP +#ifdef _OPENMP extern Ecosystem** EcoSystems; //extern StochasticData* data; #endif +extern volatile int interrupted_print; Ecosystem::Ecosystem(const MainInfo& main) : printinfo(main.getPI()) { funceval = 0; - interrupted = 0; + //interrupted = 0; likelihood = 0.0; keeper = new Keeper; @@ -111,13 +112,13 @@ void Ecosystem::Optimise() { int i; for (i = 0; i < optvec.Size(); i++) { -#ifndef NO_OPENMP +#ifdef _OPENMP int j, numThr = omp_get_max_threads ( ); DoubleVector v = this->getValues(); for (j = 0; j < numThr; j++) EcoSystems[j]->Update(v); #endif -#ifdef GADGET_OPENMP +#ifdef SPECULATIVE optvec[i]->OptimiseLikelihoodOMP(); #else optvec[i]->OptimiseLikelihood(); @@ -169,7 +170,7 @@ tmpvec[i] = likevec[i]->getUnweightedLikelihood(); int iters = 0; -#ifndef NO_OPENMP +#ifdef _OPENMP int numThr = omp_get_max_threads ( ); for (i = 0; i < numThr; i++) iters += EcoSystems[i]->getFuncEval(); @@ -194,11 +195,11 @@ } void Ecosystem::writeParams(const char* const filename, int prec) const { - if ((funceval > 0) && (interrupted == 0)) { + if ((funceval > 0) && (interrupted_print == 0)) { //JMB - print the final values to any output files specified //in case they have been missed by the -print value if (printinfo.getPrint()) keeper->writeValues(likevec, printinfo.getPrecision()); } - keeper->writeParams(optvec, filename, prec, interrupted); + keeper->writeParams(optvec, filename, prec, interrupted_print); }