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

Llm/mem mgmt #117

Merged
merged 40 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
43b475c
Contract operators
lukem12345 Feb 2, 2023
fedc238
Generate functions with composed ops
lukem12345 Feb 22, 2023
888a9d6
Start chains from results of summations
lukem12345 Feb 22, 2023
c954758
Define unpacked operators
lukem12345 Feb 25, 2023
36aaf53
Added DEC matrix precomputation
GeorgeR227 Feb 27, 2023
cb65bd2
Rough implementation of prealloc wedge product.
GeorgeR227 Mar 3, 2023
a06a850
Improved decapodes wedge_product
GeorgeR227 Mar 7, 2023
2a2ddd8
Added support for more DEC operators
GeorgeR227 Mar 8, 2023
4c9f966
Run Brusselator on Icosphere6
lukem12345 Mar 8, 2023
d08531b
Rearranged memory testing files
GeorgeR227 Mar 9, 2023
6cd6074
Quick fix for Brusselator mem test
GeorgeR227 Mar 9, 2023
b5ddc2e
Prevented duplicate ops from being defined in compile_env
GeorgeR227 Mar 9, 2023
3728415
Fixed Multiscalearrays and Simulation tests
GeorgeR227 Mar 20, 2023
225f0dd
Add scaffolding for recursive node deletion
lukem12345 Mar 20, 2023
167aa8e
Remove pasted line
lukem12345 Mar 21, 2023
d2ced72
Use stack for recursive var deletion
lukem12345 Mar 21, 2023
9c8af2d
Testing for memory optimizations
GeorgeR227 Mar 22, 2023
600f8ab
Updated testing brusselator
GeorgeR227 Mar 22, 2023
c124a3f
Remove unnecessary broadcast assignment
lukem12345 Mar 22, 2023
87410d1
Run Brusselator on GPU
lukem12345 Mar 24, 2023
8a4b5e4
Cast to CPU for plotting
lukem12345 Mar 24, 2023
34a78b5
Use views in GPU
lukem12345 Mar 24, 2023
6005be3
Fix parent check in sums and add tests
lukem12345 Mar 24, 2023
a31ea69
Cleaned up testing Brusselator
GeorgeR227 Mar 27, 2023
966d8d6
Squashed commit of the following:
GeorgeR227 Mar 27, 2023
4709635
Started work on compiler optimizations
GeorgeR227 Mar 30, 2023
9acf396
Added optimizations for Op2 and Summations
GeorgeR227 Mar 30, 2023
e624241
Support using mul! for op1 DEC calls
GeorgeR227 Mar 30, 2023
8f679a5
Added optimizing compiler
GeorgeR227 Mar 31, 2023
7bf3e9a
Added support for DualForms in optimizations
GeorgeR227 Apr 4, 2023
945e9dd
Cleaned up the type inference system
GeorgeR227 Apr 6, 2023
30dcd5e
Integrated optimizing compiler into Decapodes
GeorgeR227 Apr 13, 2023
4c3a645
Run optimizations on pressure-driven flow
GeorgeR227 Apr 20, 2023
e3cb1a1
Squashed commit of the following:
GeorgeR227 Apr 28, 2023
4079da7
Patched some errors caused by merging
GeorgeR227 Apr 28, 2023
d337e8c
Merge branch 'main' into llm/mem_mgmt
GeorgeR227 Apr 28, 2023
cc8430b
Cleaned up some code
GeorgeR227 Apr 28, 2023
781c76c
Removed return
GeorgeR227 Apr 28, 2023
93bcaba
Shifted type inference ahead
GeorgeR227 May 1, 2023
0b6f284
Removing debugging packages from Project.toml
lukem12345 May 2, 2023
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
9 changes: 2 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name = "Decapodes"
uuid = "679ab3ea-c928-4fe6-8d59-fd451142d391"
authors = [
"James Fairbanks",
"Andrew Baas",
"Evan Patterson",
"Luke Morris",
"George Rauta",
]
authors = ["James Fairbanks", "Andrew Baas", "Evan Patterson", "Luke Morris", "George Rauta"]
version = "0.2.0"

[deps]
AlgebraicRewriting = "725a01d3-f174-5bbd-84e1-b9417bad95d9"
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
CombinatorialSpaces = "b1c52339-7909-45ad-8b6a-6e388f7c67f2"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Expand Down
21 changes: 12 additions & 9 deletions examples/sw/pressure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using OrdinaryDiffEq
using MLStyle
using Distributions
using LinearAlgebra
using Catlab.ACSetInterface
using GLMakie
using Logging
# using CairoMakie
Expand All @@ -21,7 +22,7 @@ PressureFlow = quote

# derived quantities
ΔV::Form1{X}
∇P::Form0{X}
∇P::Form1{X}
ΔP::Form0{X}
ϕₚ::Form1{X}

Expand Down Expand Up @@ -54,7 +55,7 @@ function generate(sd, my_symbol; hodge=GeometricHodge())
:α => x->0*x
:β => x->2000*x
:γ => x->1*x
:⋆₀ => x->⋆(0,sd,hodge=hodge)*x
#= :⋆₀ => x->⋆(0,sd,hodge=hodge)*x
:⋆₁ => x->⋆(1, sd, hodge=hodge)*x
:⋆₀⁻¹ => x->inv_hodge_star(0,sd, x; hodge=hodge)
:⋆₁⁻¹ => x->inv_hodge_star(1,sd,hodge=hodge)*x
Expand All @@ -64,22 +65,22 @@ function generate(sd, my_symbol; hodge=GeometricHodge())
:dual_d₁ => x->dual_derivative(1,sd)*x
:∧₀₁ => (x,y)-> wedge_product(Tuple{0,1}, sd, x, y)
:plus => (+)
:(-) => x-> -x
:(-) => x-> -x =#
# :L₀ => (v,x)->dual_derivative(1, sd)*(i0(v, x))
:L₀ => (v,x)->begin
#= :L₀ => (v,x)->begin
# dual_derivative(1, sd)*⋆(1, sd)*wedge_product(Tuple{1,0}, sd, v, x)
⋆(1, sd; hodge=hodge)*wedge_product(Tuple{1,0}, sd, v, x)
end
end =#
:i₀ => i0
:Δ₀ => x -> begin # dδ
δ(1, sd, d(0, sd)*x, hodge=hodge) end
#= :Δ₀ => x -> begin # dδ
δ(1, sd, d(0, sd)*x, hodge=hodge) end
# :Δ₀ => x -> begin # d ⋆ d̃ ⋆⁻¹
# y = dual_derivative(1,sd)*⋆(1, sd, hodge=hodge)*d(0,sd)*x
# inv_hodge_star(0,sd, y; hodge=hodge)
# end
:Δ₁ => x -> begin # dδ + δd
δ(2, sd, d(1, sd)*x, hodge=hodge) + d(0, sd)*δ(1, sd, x, hodge=hodge)
end
end =#

# :Δ₁ => x -> begin # d ⋆ d̃ ⋆⁻¹ + ⋆ d̃ ⋆ d
# y = dual_derivative(0,sd)*⋆(2, sd, hodge=hodge)*d(1,sd)*x
Expand All @@ -88,7 +89,8 @@ function generate(sd, my_symbol; hodge=GeometricHodge())
# return y + z
# end
:debug => (args...)->begin println(args[1], length.(args[2:end])) end
x=> error("Unmatched operator $my_symbol")
# x=> error("Unmatched operator $my_symbol")
_ => default_dec_generate(sd, my_symbol, hodge)
end
# return (args...) -> begin println("applying $my_symbol"); println("arg length $(length.(args))"); op(args...);end
return (args...) -> op(args...)
Expand All @@ -104,6 +106,7 @@ primal_earth = loadmesh(Icosphere(3, radius))
nploc = argmax(x -> x[3], primal_earth[:point])

orient!(primal_earth)
primal_earth[:edge_orientation] = false
earth = EmbeddedDeltaDualComplex2D{Bool,Float64,Point3D}(primal_earth)
subdivide_duals!(earth, Circumcenter())

Expand Down
12 changes: 11 additions & 1 deletion examples/sw/sw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Point3D = Point3{Float64}

flatten(vfield::Function, mesh) = ♭(mesh, DualVectorField(vfield.(mesh[triangle_center(mesh),:dual_point])))

function generate(sd, my_symbol; hodge=GeometricHodge())
#= function generate(sd, my_symbol; hodge=GeometricHodge())
i0 = (v,x) -> ⋆(1, sd, hodge=hodge)*wedge_product(Tuple{0,1}, sd, v, inv_hodge_star(0,sd, hodge=DiagonalHodge())*x)
op = @match my_symbol begin
:k => x->2000x
Expand All @@ -36,6 +36,15 @@ function generate(sd, my_symbol; hodge=GeometricHodge())
:debug => (args...)->begin println(args[1], length.(args[2:end])) end
end
# return (args...) -> begin println("applying $my_symbol"); println("arg length $(length.(args))"); op(args...);end
return (args...) -> op(args...)
end =#

function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
:k => x->2000x
_ => default_dec_generate(sd, my_symbol, hodge)
end

return (args...) -> op(args...)
end

Expand Down Expand Up @@ -67,6 +76,7 @@ const RADIUS = 6371+90
#primal_earth = loadmesh(ThermoIcosphere())
primal_earth = loadmesh(Icosphere(4, RADIUS))
nploc = argmax(x -> x[3], primal_earth[:point])
primal_earth[:edge_orientation] = false
orient!(primal_earth)
earth = EmbeddedDeltaDualComplex2D{Bool,Float64,Point3D}(primal_earth)
subdivide_duals!(earth, Circumcenter())
Expand Down
6 changes: 4 additions & 2 deletions src/Decapodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Catlab.Programs
using Catlab.CategoricalAlgebra
using Catlab.WiringDiagrams
using Catlab.WiringDiagrams.DirectedWiringDiagrams
using Catlab.ACSetInterface
using LinearAlgebra
using MLStyle
using Base.Iterators
Expand All @@ -18,11 +19,12 @@ export normalize_unicode, DerivOp, append_dot,
SchDecapode, SchNamedDecapode, AbstractDecapode, AbstractNamedDecapode, Decapode, NamedDecapode, SummationDecapode, fill_names!, expand_operators, add_constant!, add_parameter, infer_types!, resolve_overloads!, op1_inf_rules_1D, op2_inf_rules_1D, op1_inf_rules_2D, op2_inf_rules_2D, op1_res_rules_1D, op2_res_rules_1D, op1_res_rules_2D, op2_res_rules_2D,
Term, Var, Judge, Eq, AppCirc1, AppCirc2, App1, App2, Plus, Tan, term, parse_decapode,
VectorForm, PhysicsState, findname, findnode,
compile, compile_env, gensim, closest_point, flat_op,
compile, compile_env, gensim, evalsim, closest_point, flat_op,
AbstractMeshKey, loadmesh, Icosphere, Rectangle_30x10, Torus_30x10, Point_Map,
Open, OpenSummationDecapodeOb, OpenSummationDecapode, unique_by, unique_by!, oapply,
CartesianPoint, SpherePoint, r, theta, phi, TangentBasis, θhat, ϕhat,
average_rewrite,
average_rewrite, recursive_delete_parents, contract_operators,
default_dec_matrix_generate, default_dec_generate,
@decapode

normalize_unicode(s::String) = Unicode.normalize(s, compose=true, stable=true, chartransform=Unicode.julia_chartransform)
Expand Down
Loading