Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU count is not configurable in mproc/umproc implementations #120

Open
havanagrawal opened this issue Feb 16, 2018 · 5 comments
Open

CPU count is not configurable in mproc/umproc implementations #120

havanagrawal opened this issue Feb 16, 2018 · 5 comments

Comments

@havanagrawal
Copy link
Contributor

In mproc.py and umproc.py, the code uses the maximum CPU count by default for computation.

This isn't always the best idea. For instance, in my particular use case, I am running spotpy on a shared 64-core machine and would like to specify the maximum amount of CPU's to use so I don't hog the resource (and I don't wish to use mpi).

This shouldn't be a large change in my estimate. We can pick up the maximum CPU count from the spot_setup instance if it exists, and otherwise just default to max CPU count.

Not sure if there is another recommended way of doing this in spotpy, or if I should go ahead and make a PR.

@thouska
Copy link
Owner

thouska commented Feb 16, 2018

So far, there is no recommended way to do this.
Your idea of picking the CPU number from the spot_setup instance sounds like a good idea to me.

@philippkraft
Copy link
Collaborator

I would recommend to leave the spot_setup instance out of it, because the number of cores is definetly a property of the sampler and not of the setup. How about an attribute of _algorithm, that can be set?

@thouska
Copy link
Owner

thouska commented Feb 19, 2018

A setting of the cpu-cores via _algorithm might be a little bit confusing, because some people might think it is also valid for mpi?
What about setting the cores prior to the sampling e.g. via spotpy.parallel.mproc.cpu_cores = 5

philippkraft added a commit to philippkraft/spotpy that referenced this issue Feb 22, 2018
@havanagrawal
Copy link
Contributor Author

I personally feel that setting a global variable as a setting parameter can get confusing. I like the thought of putting it into _algorithm.py.

In order to avoid confusion with the mpi setting, we could always put it in the docs saying the setting is only used if mproc or umproc is being used, and ignored otherwise. I've seen this style in multiple libraries (sklearn being one of them), so I'm pretty sure it's idiomatic.

@thouska
Copy link
Owner

thouska commented Apr 13, 2021

This should be taken into account when fixing #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants