cpu usage of rstudio

hi my friends,
rstudio doesnt use more than %10 cpu resource. ı dont run any other application at the same time. resources are avaliable but usage ratio of cpu is %10. how can ı provide to use more cpu resources?
thanks.
image

I might be missing something, but I think it's expected: it's just that R currently doesn't need more. If you start a heavy computation, then the CPU usage might increase.

Even with a heavy computation, it might not go to 100% because the limiting factor may not be the CPU, but for example the memory access.

Another aspect is the number of cores: if you're doing an intensive sequential computation, the CPU is the limiting factor, but at any given point only one computation can be done, so only one core is used, and the total CPU usage is low. In R, run this code:

for(i in 1:1e8) 1

you should see the usage increase, but because only one CPU can be used at a time, the total usage might stay at around 10-30% (depends on your computer). Now let's use several cores:

library(parallel)
nb_cores <- detectCores()
cl <- makeCluster(nb_cores-1)

res <- parLapply(cl, 1:1e8, \(x) 1)

In my case this rises to 100% CPU usage (but note that since the results need to be saved in res, there is also memory access that can be slower than the CPU)

I use 127 million row and 9 column. I do some calculations witg this data. I also open 10 rstudio window and ı press all
rstudio windows run button one by one. Then all rstudio windows use %10 cpu per one window.

That's typically because it can't use more, either because it's using one core at a time (and is limited by the speed of a core), or because getting the data from memory to the core is the limiting factor.

If the computation is too slow, there may be ways to speed it up, by rewriting it, using fast packages, or parallel processing. If that's the problem feel free to open a new question with details about the computation.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.