Giter VIP home page Giter VIP logo

Comments (14)

eddelbuettel avatar eddelbuettel commented on June 3, 2024 1

It's good. And the double branch is probably also what we need to set options properly. No need to get too cute.

One type as you use two hyphens: --n where it should be one -n. I will clean that up.

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

That sounds like a great idea, and should be pretty simple. Both -n are -p are open. Preferences?

from littler.

csgillespie avatar csgillespie commented on June 3, 2024

My preference would be for -n. What do you think about having a slight tweak to the input? I quite often set Ncpus equal to the number of cores. This would translate to:

  • Default: n = 1 -> (Ncpus = 1)
  • n = X -> (Ncpus = X)
  • n = 0 -> Ncpus = max(1, parallel::detectCores())

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

I like the option of 'maxing out' but I am not sure I like zero for that special value. Hm. Minus one? NA? NULL?

I am indifferent between -n or -p (for "proceses") or even -c (for "cores"). All suitable.

from littler.

csgillespie avatar csgillespie commented on June 3, 2024

I quite like the -c and -1 combination.

Do you have a preference for the default? Either Ncpus = 1 or Ncpus = getOption("Ncpus", 1L) to match install.packages()

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

I like Ncpus = getOption("Ncpus", 1L) as we can sail with the wind of that existing option.

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

Main question now if we call it -c for cores or cpus when we both know it processes. Maybe coroutines ;-)

from littler.

csgillespie avatar csgillespie commented on June 3, 2024

That just occurred to me as I wrote the doc string. Back to -n ?

Also, I'll go for NULL as that matches (sort of) the repo logic

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

Sure.

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

Looks good. Thanks for catching the rogue = which is definitely bad style :)

I am wondering if we should fold the two branches into one. Ie detect "getOption" as you do but then default to detect the system cores as a fallback, ie

if (opt$ncpus == "getOption") {
  # parallel comes with R 2.14+
  opt$ncpus <- getOption("Ncpus", max(1L, parallel::detectCores()))
}

Thoughts? It may well be too aggressive as it would hog all cores unless told otherwise...

Similarly, two lines in the --help text is one more than every other option gets and something I'll probably clean up. Installing Rcpp as an illustration is also weird as that one does not have that many dependencies (ie: none) to benefit from Ncpus which after all only benefits multiple packages at once. Maybe ggplot2 or lme4 or ... ?

from littler.

csgillespie avatar csgillespie commented on June 3, 2024
  • Rcpp: I didn't check the number of dep'. Just assumed it was > 1. Changing to ggplot2 makes sense.

  • If we fold the branches, we will change the default behaviour of install.packages() and also the current behaviour of install2.r (as you note). I'm happy with this change, and can't imagine why it's bad. To make it less aggressive, we could use max(1, parallel::detectCores() - 1)

  • Two lines in help: Yep I didn't like that either, but it's a side effect of having a "special" option.

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

I think that is still too much. We share a big box at work with 36 hyperthreaded cores. If someone uses it there... For example mclapply() does a simple getOption("mc.cores", 2L) giving us 2. install.packages() defaults to 1 unless told otherwise.

We'll make it one line in --help but describe it in the main help body.

from littler.

csgillespie avatar csgillespie commented on June 3, 2024

Updated the PR:

  • Rcpp -> ggplot2
  • Removed one of the examples in help

from littler.

eddelbuettel avatar eddelbuettel commented on June 3, 2024

Also four space indent not two but all minor -- taken care of now.

Thanks again for this. Very nice enhancement.

from littler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.