Skip to content

Conversation

@emanuel-schmid
Copy link
Collaborator

@emanuel-schmid emanuel-schmid commented Aug 2, 2023

Changes proposed in this PR:

  • When chunksizes for pool.map are calculated, make sure they are at least 1.

This PR fixes #761

PR Author Checklist

PR Reviewer Checklist

@emanuel-schmid emanuel-schmid requested a review from chahank August 2, 2023 14:35
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)
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is being done in #763. I propose to merge #763 first.

Copy link
Member

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.

@chahank chahank mentioned this pull request Aug 3, 2023
13 tasks
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Collaborator Author

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.

Copy link
Member

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

@emanuel-schmid emanuel-schmid merged commit da8d861 into develop Aug 4, 2023
@emanuel-schmid emanuel-schmid deleted the feature/chunksize_gt0 branch August 4, 2023 14:19
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

Successfully merging this pull request may close these issues.

3 participants