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

Full scheduler::Symbol support + Keyword argument forwarding #81

Merged
merged 18 commits into from
Mar 13, 2024
Merged
Prev Previous commit
Next Next commit
dont allow ntasks and nchunks at the same time
  • Loading branch information
carstenbauer committed Mar 12, 2024
commit 70b42ce8d6a13c595d3a143371d19bcbf05fb515
6 changes: 6 additions & 0 deletions src/schedulers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ function DynamicScheduler(;
nchunks = 2 * nthreads(threadpool)
chunksize = -1
else
if !isnothing(nchunks) && !isnothing(ntasks)
throw(ArgumentError("nchunks and ntasks are aliases and only one may be provided"))
end
nchunks = !isnothing(nchunks) ? nchunks :
!isnothing(ntasks) ? ntasks : -1
chunksize = isnothing(chunksize) ? -1 : chunksize
Expand Down Expand Up @@ -190,6 +193,9 @@ function StaticScheduler(;
nchunks = nthreads(:default)
chunksize = -1
else
if !isnothing(nchunks) && !isnothing(ntasks)
throw(ArgumentError("nchunks and ntasks are aliases and only one may be provided"))
end
nchunks = !isnothing(nchunks) ? nchunks :
!isnothing(ntasks) ? ntasks : -1
chunksize = isnothing(chunksize) ? -1 : chunksize
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ end;
@test tmapreduce(sin, +, 1:10000; chunksize=2, scheduler=s) ≈ res_tmr
@test tmapreduce(sin, +, 1:10000; chunking=false, scheduler=s) ≈ res_tmr
@test tmapreduce(sin, +, 1:10000; nchunks=3, scheduler=s) ≈ res_tmr
@test tmapreduce(sin, +, 1:10000; ntasks=3, scheduler=s) ≈ res_tmr
@test_throws ArgumentError tmapreduce(sin, +, 1:10000; ntasks=3, nchunks=2, scheduler=s) ≈ res_tmr
end
end;

Expand Down
Loading