diff --git a/MyTimer.cpp b/MyTimer.cpp index 0681cd0..7bb34c0 100644 --- a/MyTimer.cpp +++ b/MyTimer.cpp @@ -9,7 +9,7 @@ void MyTimer::adjust(double &time,char f){//{{{ if(f=='h')time/=3600.0; }//}}} void MyTimer::write(double time,char f){//{{{ - if(!quiet)messageF("[time: +%lf %c]\n",time,f); + if(!quiet)messageF("[time: +%.2lf %c]\n",time,f); }//}}} MyTimer::MyTimer(){//{{{ N=1; @@ -33,6 +33,13 @@ double MyTimer::split(long timer, char f){//{{{ times[timer]=time(NULL); return ret; }//}}} +double MyTimer::getTime(long timer, char f){//{{{ + if(timer>=N)return 0; + double ret; + ret=time(NULL)-times[timer]; + adjust(ret,f); + return ret; +}//}}} double MyTimer::current(long timer, char f){//{{{ if(timer>=N)return 0; double ret; diff --git a/MyTimer.h b/MyTimer.h index f017e3a..26d3bcd 100644 --- a/MyTimer.h +++ b/MyTimer.h @@ -20,6 +20,7 @@ class MyTimer{ void setVerbose(){quiet=false;} void start(long timer=0); double split(long timer=0, char f='s'); + double getTime(long timer=0, char f='s'); double current(long timer=0, char f='s'); double stop(long timer=0, char f='s'); }; diff --git a/VariationalBayes.cpp b/VariationalBayes.cpp index 240ebb3..edf495f 100644 --- a/VariationalBayes.cpp +++ b/VariationalBayes.cpp @@ -129,6 +129,7 @@ void VariationalBayes::optimize(bool verbose,OPT_TYPE method,long maxIter,double double boundOld,bound,squareNorm,squareNormOld=1,valBeta=0,valBetaDiv,natGrad_i,gradGamma_i,phiGradPhiSum_r; double *gradPhi,*natGrad,*gradGamma,*searchDir,*tmpD,*phiOld; gradPhi=natGrad=gradGamma=searchDir=tmpD=phiOld=NULL; + MyTimer timer; // allocate stuff {{{ //SimpleSparse *phiGradPhi=new SimpleSparse(beta); gradPhi = new double[T]; @@ -151,6 +152,7 @@ void VariationalBayes::optimize(bool verbose,OPT_TYPE method,long maxIter,double #endif #endif boundOld=getBound(); + timer.start(); while(true){ negGradient(gradPhi); // "yuck" @@ -248,7 +250,7 @@ void VariationalBayes::optimize(bool verbose,OPT_TYPE method,long maxIter,double #ifdef SHOW_FIXED messageF("iter(%c): %5.ld bound: %.3lf grad: %.7lf beta: %.7lf fixed: %ld\n",(usedSteepest?'s':'o'),iteration,bound,squareNorm,valBeta,phi->countAboveDelta(0.999)); #else - messageF("iter(%c): %5.ld bound: %.3lf grad: %.7lf beta: %.7lf\n",(usedSteepest?'s':'o'),iteration,bound,squareNorm,valBeta); + messageF("iter(%c)[%5.lds]: %5.ld bound: %.3lf grad: %.7lf beta: %.7lf\n",(usedSteepest?'s':'o'),(long)timer.getTime(),iteration,bound,squareNorm,valBeta); #endif }else if(!quiet){ messageF("\riter(%c): %5.ld bound: %.3lf grad: %.7lf beta: %.7lf ",(usedSteepest?'s':'o'),iteration,bound,squareNorm,valBeta); diff --git a/changeList b/changeList index b501722..38e2250 100644 --- a/changeList +++ b/changeList @@ -2,6 +2,9 @@ Improvements: - parseAlignment adding option to mateNamesDiffer [!! add note that this can't be used with mixed alignments !!] +Bug fixes: +- estimateExpression didn't use more cores when number of chains was changed in parameters file. + 0.7.4 [0.7.3] (bug in copying alignment) [0.7.2] diff --git a/estimateExpression.cpp b/estimateExpression.cpp index fea466f..489968f 100644 --- a/estimateExpression.cpp +++ b/estimateExpression.cpp @@ -24,6 +24,7 @@ #define SS second //#define LOG_NEED +//#define LOG_RHAT TranscriptInfo trInfo; long M;//, mAll; // M : number of transcripts (include transcript 0 ~ Noise) @@ -155,6 +156,19 @@ void MCMC(TagAlignments *alignments,gibbsParameters &gPar,ArgumentParser &args){ vector betwVar(M),withVar(M),s2j(M),totAverage(M),av,var; vector > rHat2(M); // }}} + // Names: {{{ + stringstream sstr; + #ifdef LOG_RHAT + sstr.str(""); + sstr< gPar.targetScaleReduction()){ message("WARNING: Following transcripts failed to converge entirely\n (however the estimates might still be usable):\n"); long countUncoverged=0; - stringstream sstr; - sstr.str(); + sstr.str(""); sstr<<"# unconverged_transcripts: "; for(i=0;(i gPar.targetScaleReduction());i++){ sstr<500 000) - if((totalSamples < 5000000) && (rMean.FF > gPar.targetScaleReduction())){ + if((totalSamples*chainsN < 5000000) && (rMean.FF > gPar.targetScaleReduction())){ samplesN *= 2; }else{ quitNext = true; @@ -395,7 +419,6 @@ void MCMC(TagAlignments *alignments,gibbsParameters &gPar,ArgumentParser &args){ if(samplesN