Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
paulxshen committed Jan 11, 2025
1 parent 28e96aa commit eac41f3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
3 changes: 1 addition & 2 deletions luminescent/back.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
lumi.make_pic_inv_prob(
path, c, targets,
lvoid=0.2, iters=2, nres=15,
approx_2D_mode="TE", gpu="CUDA",)
lumi.solve(path, dev=True)
approx_2D_mode="TE")
7 changes: 3 additions & 4 deletions luminescent/luminescent/pic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ def setup(path, c, study, nres, wl,
approx_2D_mode=False):
prob = dict()
if approx_2D_mode:
ratio = 4
N = 2
prob["approx_2D_mode"] = approx_2D_mode
else:
ratio = 4
N = 3
prob["approx_2D_mode"] = None
dy = dx = wl/nres
dl = dx/ratio
dl = dx/4
dz = 1 * dx

prob["Ttrans"] = Ttrans
Expand All @@ -59,7 +57,8 @@ def setup(path, c, study, nres, wl,
prob["dy"] = dy
prob["dz"] = dz
prob["dl"] = dl
prob["ratio"] = ratio
# ratio =
# prob["ratio"] = ratio
prob["dtype"] = str(dtype)
prob["timestamp"] = datetime.datetime.now().isoformat(
timespec="seconds").replace(":", "-")
Expand Down
2 changes: 1 addition & 1 deletion luminescent/luminescent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def material_voxelate(c, dl, zmin, zmax, layers, layer_stack, path):
os.makedirs(dir, exist_ok=True)
with contextlib.redirect_stdout(None):
stltovoxel.convert_file(
os.path.join(path, f'{k}_{l1}_{l2}.stl'), os.path.join(dir, 'output.png'), voxel_size=dl/2, pad=0)
os.path.join(path, f'{k}_{l1}_{l2}.stl'), os.path.join(dir, 'output.png'), voxel_size=dl, pad=0)
layer_stack_info[k] = {
"layer": (l1, l2),
"zmin": d.zmin,
Expand Down
2 changes: 1 addition & 1 deletion luminescent/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='luminescent', # Your package name
version='0.4.4', # Your package version
version='0.4.5', # Your package version
description='A description of your package',
author='Paul Shen',
author_email='[email protected]',
Expand Down
4 changes: 2 additions & 2 deletions luminescent/tiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
wavelengths = 1.55
path = os.path.join("runs", "tiny")
lumi.make_pic_sim_prob(path, c, wavelengths=wavelengths, keys=[
"2,1"], nres=15, approx_2D_mode="TE", gpu="CUDA") # approx_2D_mode="TE")
"2,1"], nres=15, approx_2D_mode="TE") # approx_2D_mode="TE")
path = os.path.join("runs", "tiny3")
lumi.make_pic_sim_prob(path, c, wavelengths=wavelengths, keys=[
"2,1"], nres=15, gpu="CUDA") # approx_2D_mode="TE")
"2,1"], nres=15, ) # approx_2D_mode="TE")
# lumi.solve(path)
# sol = lumi.lumi_solution()
2 changes: 1 addition & 1 deletion src/core/update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function update(u, p, t, dt, field_diffdeltas, field_diffpadvals, source_instanc
dHdt = -(∇ × E + H m) μ
H += dHdt * dt

@ignore_derivatives gc()
# @ignore_derivatives gc()
# @ignore_derivatives unsafe_free!.((Js, dEdt, dHdt))
# (; E, H, (Jkeys .=> Jm)..., (Pkeys .=> Pm)...)
# namedtuple([:E => E, :H => H, (Jkeys .=> Jm)..., (Pkeys .=> Pm)...])
Expand Down
6 changes: 3 additions & 3 deletions src/pic/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ function picrun(path; array=Array, kw...)
# if AUTODIFF() || ϵ != ϵmin
a = stack(map(sort(collect(readdir(joinpath(temp, string(k)), join=true)))) do file
a = Nf.(Bool.(FileIO.load(file)))
a = downsample(a, 2)
# a = downsample(a, 2)
a = reverse(a', dims=2)
# if !AUTODIFF()
# a = sparse(a)
# end
a
end)
a = downsample(a, (1, 1, 2))
# a = downsample(a, (1, 1, 2))
# @show typeof(a)
# a = a[Base.OneTo.(min.(size(a), sz))...]

Expand Down Expand Up @@ -367,7 +367,7 @@ function picrun(path; array=Array, kw...)
# opt.maxchange = maxchange * (1 + 2l)
Jello.update_loss!(opt, l)
Flux.update!(opt_state, model, dldm)# |> gpu)
GC.gc()
GC.gc(true)
println("====\n")

end
Expand Down
8 changes: 4 additions & 4 deletions src/pictest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Random.seed!(1234)
# picrun(joinpath("runs", "mode_converter"))

# picrun(joinpath("runs", "splitter"); array=cu)
picrun(joinpath("runs", "splitter"))
# picrun(joinpath("runs", "splitter"))

# picrun(joinpath("runs", "tiny"); array=cu)
# picrun(joinpath("runs", "tiny3"); array=cu)
# picrun(joinpath("runs", "back");)# array=cu)
picrun(joinpath("runs", "tiny"); array=cu)
picrun(joinpath("runs", "tiny3"))
picrun(joinpath("runs", "back"))# array=cu)
# models[1]()

# picrun(joinpath("runs", "demux"))
Expand Down

0 comments on commit eac41f3

Please sign in to comment.