-
Notifications
You must be signed in to change notification settings - Fork 124
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
calculated chunksizes greater than zero #762
Conversation
@@ -198,7 +198,7 @@ def uncertainty(self, unc_data, pool=None, **cost_benefit_kwargs): | |||
with log_level(level='ERROR', name_prefix='climada'): | |||
if pool: | |||
LOGGER.info('Using %s CPUs.', pool.ncpus) | |||
chunksize = min(unc_data.n_samples // pool.ncpus, 100) | |||
chunksize = max(min(unc_data.n_samples // pool.ncpus, 100), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently rewriting the parallel computing for the unsequa module as it was not working properly. So these changes are probably not needed. I will update at the end of today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, since #763 might take some time to review, we can also merge this pull request first.
@@ -205,7 +205,7 @@ def uncertainty(self, | |||
with log_level(level='ERROR', name_prefix='climada'): | |||
if pool: | |||
LOGGER.info('Using %s CPUs.', pool.ncpus) | |||
chunksize = min(unc_sample.n_samples // pool.ncpus, 100) | |||
chunksize = max(min(unc_sample.n_samples // pool.ncpus, 100), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chunksize = max(min(unc_sample.n_samples // pool.ncpus, 100), 1) | |
chunksize = min(unc_sample.n_samples // pool.ncpus + 1, 100) |
I think this is more elegant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Maybe. But when you have 6 samples and 3 cpus the chunksize is 3 where 2 would fit better- right?
Doesn't matter I guess, but the elegance comes at a price of reduced readability imho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I am fine either way :D
Changes proposed in this PR:
This PR fixes #761
PR Author Checklist
develop
)PR Reviewer Checklist