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

WIP: Make Enzyme discrete adjoints work #2282

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
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
10 changes: 5 additions & 5 deletions src/integrators/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end
q = inv(qmax)
else
expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1)
qtmp = DiffEqBase.fastpow(EEst, expo) / gamma
qtmp = ^(EEst, expo) / gamma
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't these have a @fastmath (and Float32)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I was just seeing what's required in order to make Enzyme work on this.

@fastmath q = DiffEqBase.value(max(inv(qmax), min(inv(qmin), qtmp)))
# TODO: Shouldn't this be in `step_accept_controller!` as for the PI controller?
integrator.qold = DiffEqBase.value(integrator.dt) / q
Expand Down Expand Up @@ -138,8 +138,8 @@ end
if iszero(EEst)
q = inv(qmax)
else
q11 = DiffEqBase.fastpow(EEst, float(beta1))
q = q11 / DiffEqBase.fastpow(qold, float(beta2))
q11 = ^(EEst, float(beta1))
q = q11 / ^(qold, float(beta2))
integrator.q11 = q11
@fastmath q = max(inv(qmax), min(inv(qmin), q / gamma))
end
Expand Down Expand Up @@ -412,7 +412,7 @@ end
fac = min(gamma, (1 + 2 * maxiters) * gamma / (iter + 2 * maxiters))
end
expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1)
qtmp = DiffEqBase.fastpow(EEst, expo) / fac
qtmp = ^(EEst, expo) / fac
@fastmath q = DiffEqBase.value(max(inv(qmax), min(inv(qmin), qtmp)))
integrator.qold = q
end
Expand All @@ -426,7 +426,7 @@ function step_accept_controller!(integrator, controller::PredictiveController, a
if integrator.success_iter > 0
expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1)
qgus = (integrator.dtacc / integrator.dt) *
DiffEqBase.fastpow((EEst^2) / integrator.erracc, expo)
^((EEst^2) / integrator.erracc, expo)
qgus = max(inv(qmax), min(inv(qmin), qgus / gamma))
qacc = max(q, qgus)
else
Expand Down
Loading