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

[BREAKING] Multi-threading of CommonSolve functions #17

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9a027c0
initial revamp specialization and add executors
lxvm Jan 2, 2025
077c5a7
Merge branch 'main' into thread
lxvm Jan 3, 2025
0463610
add CommonSolveFourier executor
lxvm Jan 3, 2025
4e7f77a
add executor docs and missing variable
lxvm Jan 3, 2025
5ef5d2f
refactor of nestedquad with reversed initialization
lxvm Jan 16, 2025
81e17d4
remove unused keywords
lxvm Jan 17, 2025
05ea9db
composable refactor
lxvm Jan 30, 2025
6f67698
Breaking: replace (up!, post) with solve!
lxvm Feb 11, 2025
6a82beb
multithreading fix
lxvm Feb 11, 2025
031f049
pass interface tests
lxvm Feb 13, 2025
f1cde42
some fourier fixes, not yet autosymptr
lxvm Feb 14, 2025
b036773
bump polyhedra compat
lxvm Feb 14, 2025
d9a2ab4
quick fix for autosymptr
lxvm Feb 15, 2025
ffe4c9c
refactor algorithms to init integrand consistently
lxvm Feb 16, 2025
33eb572
update auxquadgk to refactor
lxvm Feb 16, 2025
b1a975a
refactor quadgk_integrand and fix fourier
lxvm Feb 16, 2025
6137eb1
remove nthreads keyword from autosymptr algorithms
lxvm Feb 16, 2025
1baa966
fix how tolerances are passed from AutoBZProblem to IntegralProblem a…
lxvm Feb 16, 2025
8653bd4
parallelize ptr no syms
lxvm Feb 17, 2025
4508bd9
restore previous symptr fourier evaluation
lxvm Feb 17, 2025
96b2152
ci version fix
lxvm Feb 17, 2025
1f494b6
docs updates
lxvm Feb 17, 2025
bea0b8a
dos fixes
lxvm Feb 17, 2025
3ea50fc
update version in docs CI
lxvm Feb 17, 2025
1a44480
fix in fourier nested quad
lxvm Feb 17, 2025
98fe48c
important autobzproblem fixes
lxvm Feb 17, 2025
30ed98b
fix unitful ptr bug
lxvm Feb 18, 2025
5073026
consolidate autoptr
lxvm Mar 12, 2025
d6e664d
create logger alg
lxvm Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add CommonSolveFourier executor
lxvm committed Jan 3, 2025
commit 0463610c3a3d6162512b6da1e12dbb9f27ff9e05
5 changes: 4 additions & 1 deletion src/algorithms_meta.jl
Original file line number Diff line number Diff line change
@@ -160,7 +160,10 @@ end
insert_counter(f::IntegralFunction, numevals) = IntegralFunction(CounterFunction(numevals, f.f), f.prototype)
insert_counter(f::InplaceIntegralFunction, numevals) = InplaceIntegralFunction(CounterFunction(numevals, f.f!), f.prototype)
insert_counter(f::InplaceBatchIntegralFunction, numevals) = InplaceBatchIntegralFunction(BatchCounterFunction(numevals, f.f!), f.prototype; max_batch=f.max_batch)
insert_counter(f::CommonSolveIntegralFunction, numevals) = CommonSolveIntegralFunction(f.prob, f.alg, CounterFunction(numevals, f.update!), f.postsolve, f.prototype, f.specialize; f.kwargs...)
function insert_counter(f::CommonSolveIntegralFunction, numevals)
f.executor isa SerialExecutor || throw(ArgumentError("Can only count serial integrands"))
CommonSolveIntegralFunction(f.prob, f.alg, CounterFunction(numevals, f.update!), f.postsolve, f.prototype, f.specialize; f.kwargs...)
end
function init_cacheval(f, dom, p, alg::EvalCounter; kws...)
numevals = Ref(0)
# some algorithms need to store the integrand in the cache
14 changes: 9 additions & 5 deletions src/fourier.jl
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ The `prototype` argument can help control how much to `specialize` on the type o
problem, which defaults to `FullSpecialize()` so that run times are improved. However
`FunctionWrapperSpecialize()` may help reduce compile times.
"""
struct CommonSolveFourierIntegralFunction{P,A,S,K,U,PS,T,M<:AbstractSpecialization} <: AbstractFourierIntegralFunction
struct CommonSolveFourierIntegralFunction{P,A,S,K,U,PS,T,M<:AbstractSpecialization,E<:AbstractExecutor} <: AbstractFourierIntegralFunction
prob::P
alg::A
s::S
@@ -71,10 +71,11 @@ struct CommonSolveFourierIntegralFunction{P,A,S,K,U,PS,T,M<:AbstractSpecializati
postsolve::PS
prototype::T
specialize::M
executor::E
alias::Bool
end
function CommonSolveFourierIntegralFunction(prob, alg, update!, postsolve, s, prototype=nothing, specialize=FullSpecialize(); alias=false, kws...)
return CommonSolveFourierIntegralFunction(prob, alg, s, NamedTuple(kws), update!, postsolve, prototype, specialize, alias)
function CommonSolveFourierIntegralFunction(prob, alg, update!, postsolve, s, prototype=nothing, specialize=FullSpecialize(), executor=SerialExecutor(); alias=false, kws...)
return CommonSolveFourierIntegralFunction(prob, alg, s, NamedTuple(kws), update!, postsolve, prototype, specialize, executor, alias)
end

function do_solve!(cache, f::CommonSolveFourierIntegralFunction, x, s, p)
@@ -321,7 +322,7 @@ function outer_integralfunction(f::CommonSolveFourierIntegralFunction, x0, p)
ws = get_fourierworkspace(f)
proto = get_prototype(f, x0, ws, p)
s = workspace_contract!(ws, x0[end])
func = CommonSolveFourierIntegralFunction(f.prob, f.alg, f.update!, f.postsolve, s, proto, f.specialize; alias=true, f.kwargs...)
func = CommonSolveFourierIntegralFunction(f.prob, f.alg, f.update!, f.postsolve, s, proto, f.specialize, f.executor; alias=true, f.kwargs...)
return func, ws, _fourier_update!, _postsolve
end

@@ -561,4 +562,7 @@ function init_cacheval(f::AbstractFourierIntegralFunction, dom, p, alg::AutoSymP
end

insert_counter(f::FourierIntegralFunction, numevals) = FourierIntegralFunction(CounterFunction(numevals, f.f), f.s, f.prototype; alias=f.alias)
insert_counter(f::CommonSolveFourierIntegralFunction, numevals) = CommonSolveFourierIntegralFunction(f.prob, f.alg, CounterFunction(numevals, f.update!), f.postsolve, f.s, f.prototype, f.specialize; alias=f.alias, f.kwargs...)
function insert_counter(f::CommonSolveFourierIntegralFunction, numevals)
f.executor isa SerialExecutor || throw(ArgumentError("Can only count serial integrands"))
CommonSolveFourierIntegralFunction(f.prob, f.alg, CounterFunction(numevals, f.update!), f.postsolve, f.s, f.prototype, f.specialize, f.executor; alias=f.alias, f.kwargs...)
end