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

Cm/docs pmap #218

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:

- label: ":scroll: Build docs and run tests"
command:
- "srun --cpus-per-task=16 --mem=8G --time=1:00:00 --output=.buildkite/build_%j.log --unbuffered .buildkite/jobscript.sh"
- "srun --cpus-per-task=16 --mem=64G --time=3:00:00 --output=.buildkite/build_%j.log --unbuffered .buildkite/jobscript.sh"
env:
JULIA_PROJECT: "docs/"

Expand Down
82 changes: 45 additions & 37 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,62 @@ if !(haskey(ENV, "GITHUB_ACTIONS") || haskey(ENV, "GITLAB_CI"))
config["repo_root_url"] = "https://github.com/AlgebraicJulia/Decapodes.jl/blob/main/docs"
end

# const literate_dir = joinpath(@__DIR__, "..", "examples")
# const generated_dir = joinpath(@__DIR__, "src", "examples")
const literate_dir = joinpath(@__DIR__, "..", "examples")
const generated_dir = joinpath(@__DIR__, "src", "examples")

# @info "Building literate files"
# for (root, dirs, files) in walkdir(literate_dir)
# out_dir = joinpath(generated_dir, relpath(root, literate_dir))
# # @showprogress pmap(files) do file
# for file in files
# f,l = splitext(file)
# if l == ".jl" && !startswith(f, "_")
# Literate.markdown(joinpath(root, file), out_dir;
# config=config, documenter=true, credit=false)
# Literate.notebook(joinpath(root, file), out_dir;
# execute=true, documenter=true, credit=false)
# end
# end
# end
@info "Building literate files"
for (root, dirs, files) in walkdir(literate_dir)
out_dir = joinpath(generated_dir, relpath(root, literate_dir))
pmap(files) do file
f,l = splitext(file)
if l == ".jl" && !startswith(f, "_")
Literate.markdown(joinpath(root, file), out_dir;
config=config, documenter=true, credit=false)
Literate.notebook(joinpath(root, file), out_dir;
execute=true, documenter=true, credit=false)
end
end
end
@info "Completed literate"

pages = Any[]
push!(pages, "Decapodes.jl" => "index.md")
push!(pages, "Overview" => "overview.md")
push!(pages, "Equations" => "equations.md")
push!(pages, "BC Debug" => "bc_debug.md")
push!(pages, "ASCII Operators" => "ascii.md")
Copy link
Member

Choose a reason for hiding this comment

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

since this part is being hard coded, it could still be a Vector{Pair{String,String}} literal and then you can push to it for the dynamically generated part later.

dirs = Dict("physics" => "Physics"
,"biology" => "Biology"
,"climate" => "Climate")
for d in keys(dirs)
dir = joinpath(@__DIR__, "src", d)
files = readdir(dir)
push!(pages, dirs[d] => joinpath.(d, files))
end

push!(pages, "Examples" => [
"Brusselator" => "examples/chemistry/brusselator.md",
"Brusselator Teapot" => "examples/chemistry/brusselator_teapot.md",
"Gray-Scott" => "examples/chemistry/gray_scott.md",
"Budyko-Sellers" => "examples/climate/budyko_sellers.md",
"Budyko-Sellers-Halfar" => "examples/climate/budyko_sellers_halfar.md",
"Burger" => "examples/diff_adv/burger.md",
])
push!(pages, "Canonical Models" => "canon.md")
push!(pages, "Library Reference" => "api.md")

@info "Building Documenter.jl docs"
makedocs(
modules = [Decapodes],
format = Documenter.HTML(
assets = ["assets/analytics.js"],
),
remotes = nothing,
sitename = "Decapodes.jl",
doctest = false,
checkdocs = :none,
pages = Any[
"Decapodes.jl" => "index.md",
"Halfar-NS" => "halmo.md",
"Overview" => "overview.md",
"Klausmeier" => "klausmeier.md",
"Glacial Flow" => "ice_dynamics.md",
"Grigoriev Ice Cap" => "grigoriev.md",
"Budyko-Sellers-Halfar" => "budyko_sellers_halfar.md",
"CISM v2.1" => "cism.md",
"NHS" => "nhs.md",
"Equations" => "equations.md",
"ASCII Operators" => "ascii.md",
"Misc Features" => "bc_debug.md",
"Pipe Flow" => "poiseuille.md",
# "Examples" => Any[
# "examples/cfd_example.md"
# ],
"Canonical Models" => "canon.md",
"Library Reference" => "api.md"
]
)
pages = pages)


@info "Deploying docs"
deploydocs(
Expand Down
File renamed without changes.
File renamed without changes.
31 changes: 5 additions & 26 deletions docs/src/grigoriev.md → docs/src/climate/grigoriev.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Point3D = Point3{Float64}; # hide
The ice thickness data is [stored in a TIF](https://zenodo.org/api/records/7735970/files-archive). We have downloaded it locally, and load it using basic `FileIO`.

``` @example DEC
file_name = "Icethickness_Grigoriev_ice_cap_2021.tif"
file_name = "../../assets/Icethickness_Grigoriev_ice_cap_2021.tif"
ice_thickness_tif = load(file_name)
```

Expand Down Expand Up @@ -112,7 +112,7 @@ halfar_eq2 = @decapode begin
n::Constant

ḣ == ∂ₜ(h)
ḣ == ∘(⋆, d, ⋆)(Γ * d(h) * avg₀₁(mag(♯(d(h)))^(n-1)) * avg₀₁(h^(n+2)))
ḣ == ∘(⋆, d, ⋆)(Γ * d(h) (mag(♯(d(h)))^(n-1)) (h^(n+2)))
end

glens_law = @decapode begin
Expand All @@ -138,36 +138,15 @@ to_graphviz(ice_dynamics)
# Define our functions

``` @example DEC
include("sharp_op.jl")
function generate(sd, my_symbol; hodge=GeometricHodge())
♯_m = ♯_mat(sd)
I = Vector{Int64}()
J = Vector{Int64}()
V = Vector{Float64}()
for e in 1:ne(s)
append!(J, [s[e,:∂v0],s[e,:∂v1]])
append!(I, [e,e])
append!(V, [0.5, 0.5])
end
avg_mat = sparse(I,J,V)
op = @match my_symbol begin
:♯ => x -> begin
♯(sd, EForm(x))
end
:mag => x -> begin
norm.(x)
end
:avg₀₁ => x -> begin
avg_mat * x
end
:^ => (x,y) -> x .^ y
:* => (x,y) -> x .* y
:abs => x -> abs.(x)
:show => x -> begin
println(x)
x
:^ => (x,y) -> begin
x .^ y
end
x => error("Unmatched operator $my_symbol")
_ => default_dec_matrix_generate(sd, my_symbol, hodge)
end
return (args...) -> op(args...)
end
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/src/poiseuille.md → docs/src/physics/poiseuille.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ In order to solve our equations, we will need numerical linear operators that gi

```@example Poiseuille
using MLStyle
include("../../examples/boundary_helpers.jl")
include("../../../examples/boundary_helpers.jl")

function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
Expand Down
60 changes: 0 additions & 60 deletions docs/src/sharp_op.jl

This file was deleted.

Loading
Loading