I'm having a problem with the error and warning functions. I've tried this on multiple machine so I'm fairly sure it's not machine dependent and I've tried it on the latest versions 2.6.0-2.7.1. Whenever my program gets to an error or warning it crashes the entire program rather than throwing the error like it should. Here are the relevant bits. ... char const * const ExeedsMinVarianceError = "PFDA ERR: Near zero variance encountered. Estimation Unstable. Terminating Estimation."; .... if(debug){printf("Da:\n");printmat(DaOld,1,*ka);fflush(stdout);} daxpy_(ka, &mOne, Da, &one, DaOld, &one); for(i=0;i<*ka;i++)convergenceCriteria+=fabs(DaOld[i]); if(Da[*ka] < MinVariance){ printf("PING");fflush(stdout); warning(ExeedsMinVarianceError); break; } and the output from running in batch mode that I get is this: Da: 0.1803 4.988e-017 PING and here the program crashes. I've tried this in multiple places and sometimes the error is thrown sometimes not. Does anyone have an idea of what is going on. I could not find any discussion of this error yet. Thank you, Andrew Redd [[alternative HTML version deleted]]
On 28/07/2008 6:41 PM, Andrew Redd wrote:> I'm having a problem with the error and warning functions. I've tried this > on multiple machine so I'm fairly sure it's not machine dependent and I've > tried it on the latest versions 2.6.0-2.7.1. Whenever my program gets to an > error or warning it crashes the entire program rather than throwing the > error like it should. > > Here are the relevant bits. > > ... > char const * const ExeedsMinVarianceError = "PFDA ERR: Near zero > variance encountered. Estimation Unstable. Terminating Estimation."; > .... > if(debug){printf("Da:\n");printmat(DaOld,1,*ka);fflush(stdout);} > daxpy_(ka, &mOne, Da, &one, DaOld, &one); > for(i=0;i<*ka;i++)convergenceCriteria+=fabs(DaOld[i]); > if(Da[*ka] < MinVariance){ > printf("PING");fflush(stdout); > warning(ExeedsMinVarianceError); > break; > } > > and the output from running in batch mode that I get is this: > Da: > 0.1803 4.988e-017 > > PING > and here the program crashes. I've tried this in multiple places and > sometimes the error is thrown sometimes not. Does anyone have an idea of > what is going on. I could not find any discussion of this error yet.I don't know if this would have any effect, but we normally suggest that you use Rprintf, not printf. If that's not relevant, you probably need to give more details: show us a complete file that does nothing but crash, let us know your platform, etc. Without reproducible code it's nearly impossible for us to diagnose errors, and often producing the reproducible code is enough to suggest to you what the problem is without any extra help. Duncan Murdoch
Rf_error is used so often in R itself and packages that it is almost certainly not the problem -- rather something else your program has done has damaged R's internals (e.g. overrrun an array). 'Writing R Extensions' discusses how to debug R code, including foreign code. For example, I would run under valgrind to look for incorrect memory accesses. This was an appropriate topic for R-devel -- please DO study the posting guide. On Mon, 28 Jul 2008, Andrew Redd wrote:> I'm having a problem with the error and warning functions. I've tried this > on multiple machine so I'm fairly sure it's not machine dependent and I've > tried it on the latest versions 2.6.0-2.7.1. Whenever my program gets to an > error or warning it crashes the entire program rather than throwing the > error like it should. > > Here are the relevant bits. > > ... > char const * const ExeedsMinVarianceError = "PFDA ERR: Near zero > variance encountered. Estimation Unstable. Terminating Estimation."; > .... > if(debug){printf("Da:\n");printmat(DaOld,1,*ka);fflush(stdout);} > daxpy_(ka, &mOne, Da, &one, DaOld, &one); > for(i=0;i<*ka;i++)convergenceCriteria+=fabs(DaOld[i]); > if(Da[*ka] < MinVariance){ > printf("PING");fflush(stdout); > warning(ExeedsMinVarianceError); > break; > } > > and the output from running in batch mode that I get is this: > Da: > 0.1803 4.988e-017 > > PING > and here the program crashes. I've tried this in multiple places and > sometimes the error is thrown sometimes not. Does anyone have an idea of > what is going on. I could not find any discussion of this error yet. > Thank you, > Andrew Redd > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Reasonably Related Threads
- [test-suite] making polybench/symm succeed with "-Ofast" and "-ffp-contract=on"
- [test-suite] making polybench/symm succeed with "-Ofast" and "-ffp-contract=on"
- reliability of R-Forge?
- reliability of R-Forge?
- [test-suite] making polybench/symm succeed with "-Ofast" and "-ffp-contract=on"