Skip to content

Commit

Permalink
begin docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale-Black committed Nov 18, 2023
1 parent 2ba19e8 commit 62b0618
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
16 changes: 6 additions & 10 deletions docs/02_multi_threading.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.26
# v0.19.32

#> [frontmatter]
#> title = "Multi-threading"
Expand Down Expand Up @@ -32,7 +32,7 @@ TableOfContents()
# ╔═╡ ede39bd3-1e20-4426-a518-abe2f574aa91
md"""
## Multi-threaded distance transforms
One of the advantages of a Julia-based distance transform library is how accessible something like multi-threading is for complex algorithms. The `Felzenszwalb` distance transform is highly parallelizable and is set up to take advantage of multi-threaded hardware.
One of the advantages of a Julia-based distance transform library is how accessible something like multi-threading is for complex algorithms. The felzenszwalb distance transform algorithm is highly parallelizable, which is what the CPU approach is based on, and is set up to take advantage of multi-threaded hardware by default.
"""

# ╔═╡ 735aa1eb-2ce8-4ae2-8181-76056aa560de
Expand All @@ -54,11 +54,8 @@ array = [
# ╔═╡ c8bd961f-14d7-4724-92f0-3d8cb24b239d
bool_array = boolean_indicator(array)

# ╔═╡ a0b300ff-2835-4440-a34d-cd1d3e5ed346
tfm = Felzenszwalb()

# ╔═╡ e38b8b56-a2cb-46a8-b5c8-9577a846ae1f
sq_euc_transform = transform(bool_array, tfm, threads)
sq_euc_transform = transform(bool_array)

# ╔═╡ 6001d3d3-a067-4df3-a613-873fb4168c11
md"""
Expand All @@ -69,7 +66,7 @@ md"""
array3D = rand([0, 1], 5, 5, 3)

# ╔═╡ 86c7fa96-b05d-42c8-b86b-331993df95fc
sq_euc_transform3D = transform(boolean_indicator(array3D), tfm, threads)
sq_euc_transform3D = transform(boolean_indicator(array3D))

# ╔═╡ b7651361-7332-4215-84dd-5cf55c61768d
md"""
Expand All @@ -92,14 +89,14 @@ begin

# Squared Euclidean DT
x2 = boolean_indicator(rand([0, 1], n, n))
sedt = @benchmark transform($x2, $tfm)
sedt = @benchmark transform($x2; threaded = false)

append!(sedt_mean, BenchmarkTools.mean(sedt).time)
append!(sedt_std, BenchmarkTools.std(sedt).time)

# Squared Euclidean DT threaded
x3 = boolean_indicator(rand([0, 1], n, n))
sedtP = @benchmark transform($x3, $tfm, $threads)
sedtP = @benchmark transform($x3; threaded = true)

append!(sedtP_mean, BenchmarkTools.mean(sedtP).time)
append!(sedtP_std, BenchmarkTools.std(sedtP).time)
Expand Down Expand Up @@ -145,7 +142,6 @@ One might wonder why, if multi-threading is so beneficial, GPUs wouldn't be util
# ╟─5104bf97-e5bf-463e-a68a-cf1a9a7f77e8
# ╠═c7914c8a-5c30-482d-9776-1121c1268b81
# ╠═c8bd961f-14d7-4724-92f0-3d8cb24b239d
# ╠═a0b300ff-2835-4440-a34d-cd1d3e5ed346
# ╠═e38b8b56-a2cb-46a8-b5c8-9577a846ae1f
# ╟─6001d3d3-a067-4df3-a613-873fb4168c11
# ╠═ae31df46-a7c8-41f3-b8e3-d5eeb1ba317c
Expand Down
4 changes: 2 additions & 2 deletions docs/03_gpu.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.26
# v0.19.32

#> [frontmatter]
#> title = "GPU"
Expand Down Expand Up @@ -91,6 +91,6 @@ One such example can be seen in the next tutorial on using distance transforms w
# ╟─ed7fea36-60ca-47e0-9046-bf2565fdd41d
# ╠═22cec81f-c503-43de-8297-ec0591e4e6c5
# ╠═afeb0802-60c1-40e0-a9e5-b13ad6af27bc
# ╟─b370e3a1-37ec-48aa-86e4-d053bf9bce3b
# ╠═b370e3a1-37ec-48aa-86e4-d053bf9bce3b
# ╠═b885869b-985e-4d73-acd9-b381e6272540
# ╟─8488fa03-8ad4-4b81-8877-4ec75018a84f
4 changes: 2 additions & 2 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ version = "1.15.1"

[[deps.DistanceTransforms]]
deps = ["GPUArraysCore", "KernelAbstractions", "LoopVectorization"]
git-tree-sha1 = "78d24c6fabfa651c61bc3c85ea724beb7620d01f"
git-tree-sha1 = "6e6e2569aea7e4470c251f713c103f3593a679fb"
repo-rev = "master"
repo-url = "https://github.com/Dale-Black/DistanceTransforms.jl.git"
uuid = "71182807-4d06-4237-8dd0-bdafe4d097e2"
version = "0.2.0"
version = "0.2.1"

[[deps.DistanceTransformsPy]]
deps = ["CondaPkg", "PythonCall"]
Expand Down
20 changes: 20 additions & 0 deletions index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ md"""
## Tutorials
"""

# ╔═╡ 8b5d431a-f91c-422b-86cf-3ace891e742f
md"""
## Python
"""

# ╔═╡ 71604c4c-6d3a-4b22-bb47-8144604148be
md"""
## Benchmarks
Expand Down Expand Up @@ -83,6 +88,11 @@ struct Article
image_url::String
end

# ╔═╡ e0ef1b4d-0076-410c-b325-32a7a274f487
article_list_python = Article[
Article("Python", "https://colab.research.google.com/drive/1-CDqQgrBHoxNqs2IbMebMRxsp0m21jSa?usp=sharing", "https://img.freepik.com/free-vector/code-typing-concept-illustration_114360-3581.jpg?size=626&ext=jpg&ga=GA1.1.1694943658.1700350224&semt=sph"),
];

# ╔═╡ b7c92fa4-ed51-495d-ba82-5ae61b3de194
article_list_quickstart = Article[
Article("Getting Started", "docs/01_getting_started.jl", "https://img.freepik.com/free-photo/futuristic-spaceship-takes-off-into-purple-galaxy-fueled-by-innovation-generated-by-ai_24640-100023.jpg"),
Expand Down Expand Up @@ -134,6 +144,13 @@ to_html(
)
)

# ╔═╡ 75f02433-7ef3-45f4-ad2a-d610923824af
to_html(
divv(:class => "flex flex-wrap justify-center items-start",
[article_card(article, "secondary"; data_theme = data_theme) for article in article_list_python]...
)
)

# ╔═╡ 1198c970-07a0-464a-b853-aa737634c0e5
to_html(
divv(:class => "flex flex-wrap justify-center items-start",
Expand All @@ -154,6 +171,8 @@ to_html(
# ╟─9f5666d8-b86b-46d1-a97a-f7f708fdedb6
# ╟─5e70dc3d-85b6-4149-9962-70215d3c7f1e
# ╟─ace65d98-fe6b-45b7-990d-df8f59f6a5b3
# ╟─8b5d431a-f91c-422b-86cf-3ace891e742f
# ╟─75f02433-7ef3-45f4-ad2a-d610923824af
# ╟─71604c4c-6d3a-4b22-bb47-8144604148be
# ╟─1198c970-07a0-464a-b853-aa737634c0e5
# ╟─b3349485-1a5f-4da6-be79-965fec5fbc13
Expand All @@ -166,6 +185,7 @@ to_html(
# ╟─09b3d1e1-b44f-461d-abaf-2e5a1f6f6cc2
# ╟─b7c92fa4-ed51-495d-ba82-5ae61b3de194
# ╟─0d222d9d-7576-40a7-acb4-b0e27f9a9ef8
# ╟─e0ef1b4d-0076-410c-b325-32a7a274f487
# ╟─6cf265a0-5b72-4e5d-bb16-77ff69de566e
# ╟─8d11bae1-d232-4c03-981a-cd9f1db24e6b
# ╟─3bcd40f0-e8dd-48bd-8249-51b89f5766de

0 comments on commit 62b0618

Please sign in to comment.