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

Disabling Chunking: unsupport nchunks=0 in favor of chunking=false #71

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

carstenbauer
Copy link
Member

As discussed with @MasonProtter in private, it isn't entirely obvious what nchunks=0 means - there are different possible interpretations - which is why we no longer support it. Instead, we introduce a new keyword argument chunking that can be used to toggle chunking.

Corresponding part of the docstring:

•  chunking::Bool (default true):
     • Controls whether input elements are grouped into chunks (true) or not (false).
     • For chunking=false, the arguments nchunks, chunksize, and split are ignored and input elements are
       regarded as "chunks" as is. Hence, there will be one parallel task spawned per input element. Note that,
       depending on the input, this might spawn many(!) tasks and can be costly!

Example:

julia> Threads.nthreads()
6

julia> tmapreduce(+, 1:12; scheduler=StaticScheduler(; chunking=false)) do i
           println(i, "", Threads.threadid())
           i
       end
3  3
4  4
9  3
10  4
2  2
6  6
8  2
5  5
12  6
11  5
1  1
7  1
78

@carstenbauer carstenbauer added enhancement New feature or request breaking labels Mar 7, 2024
Copy link
Member

@MasonProtter MasonProtter left a comment

Choose a reason for hiding this comment

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

Yup, looks good!

@carstenbauer carstenbauer merged commit 0a8aca1 into master Mar 7, 2024
12 checks passed
@carstenbauer carstenbauer deleted the cb/nochunking branch March 7, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants