Skip to content

Commit

Permalink
Float32 2048 GPU BilinearLens MAP_marg working
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Sep 9, 2020
1 parent 2aadf79 commit 292bcea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/maximization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ function MAP_joint(
cache_function = nothing,
callback = nothing,
interruptable::Bool = false,
progress::Bool = true)
progress::Bool = true,
aggressive_gc = fieldinfo(ds.d).Nside>=1024
)

if !(isa(quasi_sample,Bool) || isa(quasi_sample,Int))
throw(ArgumentError("quasi_sample should be true, false, or an Int."))
Expand Down Expand Up @@ -177,7 +179,8 @@ function MAP_joint(
conjgrad_kwargs=(hist=(:i,:res), progress=(progress==:verbose), conjgrad_kwargs...),
preconditioner=preconditioner
)

aggressive_gc && GC.gc(true)

f°, = mix(f,ϕ,ds)
lnPcur = lnP(:mix,f°,ϕ,ds)

Expand Down Expand Up @@ -233,6 +236,7 @@ function MAP_marg(
Nsims = 50,
Nbatch = 1,
progress::Bool = true,
aggressive_gc = fieldinfo(ds.d).Nside>=512
)

ds = (@set ds.G = 1)
Expand All @@ -250,6 +254,7 @@ function MAP_marg(
pbar = Progress(nsteps, (progress ? 0 : Inf), "MAP_marg: ")

for i=1:nsteps
aggressive_gc && GC.gc(true)
g, state = δlnP_δϕ(
ϕ, θ, ds,
use_previous_MF = i>nsteps_with_meanfield_update,
Expand Down
2 changes: 1 addition & 1 deletion src/posterior.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function δlnP_δϕ(
f_wf, hist = argmaxf_lnP(
Lϕ, θ, ds;
which = :wf,
guess = (f_wf_guess==nothing ? nothing : f_wf_guess),
guess = (f_wf_guess==nothing ? 0d : f_wf_guess),
conjgrad_kwargs = (hist=(:i,:res), conjgrad_kwargs...)
)
v =' \ (Cf \ f_wf)
Expand Down

0 comments on commit 292bcea

Please sign in to comment.