iacob at ceremade.dauphine.fr
2008-Feb-04 15:45 UTC
[Rd] maybe a bug in the system.time() function? (PR#10696)
Full_Name: Alessandra Iacobucci Version: 2.5.1 OS: Mac OS X 10.4.11 Submission from: (NULL) (193.48.71.92) Hi, I am making some intensive simulations for the testing of a Population Monte Carlo algorithm. This involves also a study of the CPU times in two different case. What I am trying to measure is the "real" CPU time, the one which is independent on the %CPU. I'm using the "system.time" function with gcFirst=TRUE and I realized that all of the output values (user, system and elapsed) depend on the percentage of the CPU, meaning that if your program is the only one running on the machine, system.time() gives you certain values, and if there are many programs running at the same time, for the exact same simulation system.time() gives you much higher values. Thanks for you answer. Best regards, Alessandra Iacobucci
Hin-Tak Leung
2008-Feb-04 18:22 UTC
[Rd] (PR#10696) maybe a bug in the system.time() function?
You will get yelled at by others for posting a question as a bug... (sigh). See FAQ. That said, your understanding of the output of system.time() is wrong. The value you are after is simply user+system. %CPU is essentially user+system/elapsed. It is elapsed which is dependent on system load, not the other two (usually). Back into replying more in the usual R-devel sarcastic style... if you don't understand what user/system/elapsed means, you really have no place studying CPU loads... iacob at ceremade.dauphine.fr wrote:> Full_Name: Alessandra Iacobucci > Version: 2.5.1 > OS: Mac OS X 10.4.11 > Submission from: (NULL) (193.48.71.92) > > > Hi, > I am making some intensive simulations for the testing of a Population Monte > Carlo algorithm. This involves also a study of the CPU times in two different > case. > What I am trying to measure is the "real" CPU time, the one which is independent > on the %CPU. > > I'm using the "system.time" function with gcFirst=TRUE and I realized that all > of the output values (user, system and elapsed) depend on the percentage of the > CPU, meaning that if your program is the only one running on the machine, > system.time() gives you certain values, and if there are many programs running > at the same time, for the exact same simulation system.time() gives you much > higher values. > > Thanks for you answer. > > Best regards, > > Alessandra Iacobucci > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Hin-Tak Leung
2008-Feb-06 20:37 UTC
[Rd] (PR#10696) maybe a bug in the system.time() function?
Alessandra Iacobucci wrote:> > On Feb 4, 2008, at 7:22 PM, Hin-Tak Leung wrote: > >> You will get yelled at by others for posting a question as a bug... >> (sigh). See FAQ. > > I am a non-member so my message should normally pass through a moderator.Your understanding is again wrong - AFAIK, R-devel/R-user don't moderate against mon-members - *and* the point of the FAQ is that it *wastes* core R member's time to clear up non-bugs on the bug tracking system, so you are wrong on 3 counts there (wrong for posting non-bugs as bug reports, wrong for assuming that non-bug reports are moderated, and wrong to assume that moderator/R-core member's time are not valuable). A simple question like yours to R-devel/R-user can be answered by non-R-core people who is experienced in R, and more of them, that's the difference. Please read the FAQ, and read the spirit behind it as well.>> That said, your understanding of the output of system.time() is wrong. >> The value you are after is simply user+system. %CPU is essentially >> user+system/elapsed. It is elapsed which is dependent on system >> load, not the other two (usually). > > Usually. By running a given simulation I got > > user system elapsed > 6.161 0.066 6.608 > > By running the same exact simulation (same set of parameters, same > seeds, same everything) and running contemporaneously other two > processes this is what I got > > 7.515 0.084 11.062 > > As you can see, and this is what it strikes me and push me to that > wretched action, it is not only the elapsed time that depends on %CPU. I > would have expected the same value for user or system time. > >> >> Back into replying more in the usual R-devel sarcastic style... if you >> don't understand what user/system/elapsed means, you really have no >> place studying CPU loads... > > I surely have no place in studying CPU loads. Now, could you tell me why > I do not get the same values? > > Is it possible to get or how could one calculate just the amount of time > that the machine spends in doing just this simulation and nothing else, > without asking the entire department not to use it? > > Thanks in advance for you answer.First, for something like <10 sec you are going to have uncertainty from the garbage collection, and the granularity of sampling - you need to time something that's a bit longer to get out of both of these; 2nd, you never mention anything about your machine/architecture of your Mac OS X box. Your system is probably running on multi-core CPUs, which looks like more than 1 CPU from some applications, but certain kind of applications do interfere with each other on multi-core CPUs (it is really just one pretending to be two), and there is not much you can do about it, other than, as you said, ask others not to use it.>> iacob at ceremade.dauphine.fr wrote: >>> Full_Name: Alessandra Iacobucci >>> Version: 2.5.1 >>> OS: Mac OS X 10.4.11 >>> Submission from: (NULL) (193.48.71.92) >>> Hi, >>> I am making some intensive simulations for the testing of a >>> Population Monte >>> Carlo algorithm. This involves also a study of the CPU times in two >>> different >>> case. >>> What I am trying to measure is the "real" CPU time, the one which is >>> independent >>> on the %CPU. I'm using the "system.time" function with gcFirst=TRUE >>> and I realized that all >>> of the output values (user, system and elapsed) depend on the >>> percentage of the >>> CPU, meaning that if your program is the only one running on the >>> machine, >>> system.time() gives you certain values, and if there are many >>> programs running >>> at the same time, for the exact same simulation system.time() gives >>> you much >>> higher values. >>> Thanks for you answer. >>> Best regards, >>> Alessandra Iacobucci >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >> >