Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Feb 11, 2024
1 parent c266241 commit bfa7919
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 28 deletions.
24 changes: 4 additions & 20 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ version = "0.5.0"

[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "ab79d1f9754a3988a7792caec43bfdc03996020f"
git-tree-sha1 = "ad25e7d21ce10e01de973cdc68ad0f850a953c52"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.21.0"
version = "1.21.1"
weakdeps = ["SparseArrays"]

[deps.ChainRulesCore.extensions]
Expand Down Expand Up @@ -297,22 +297,11 @@ git-tree-sha1 = "60e3045590bd104a16fefb12836c00c0ef8c7f8c"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.0.13+0"

[[deps.OrderedCollections]]
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.6.3"

[[deps.PCRE2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
version = "10.42.0+1"

[[deps.Parameters]]
deps = ["OrderedCollections", "UnPack"]
git-tree-sha1 = "34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe"
uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
version = "0.12.3"

[[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821"
Expand Down Expand Up @@ -345,10 +334,10 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[deps.RadonKA]]
deps = ["Atomix", "ChainRulesCore", "FFTW", "IndexFunArrays", "KernelAbstractions", "Parameters", "PrecompileTools"]
deps = ["Atomix", "ChainRulesCore", "FFTW", "IndexFunArrays", "KernelAbstractions", "PrecompileTools"]
path = ".."
uuid = "86de8297-835b-47df-b249-c04e8db91db5"
version = "0.3.1"
version = "0.6.0"

[[deps.Random]]
deps = ["SHA"]
Expand Down Expand Up @@ -428,11 +417,6 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[deps.UnPack]]
git-tree-sha1 = "387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b"
uuid = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
version = "1.0.2"

[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

Expand Down
58 changes: 50 additions & 8 deletions docs/src/benchmark.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Benchmark and Comparison with Matlab and Astra
# Benchmark and Comparison with Matlab, Astra, torch-radon
Tested on a AMD Ryzen 9 5900X 12-Core Processor with 24 Threads and a NVIDIA GeForce RTX 3060 with Julia 1.10.0 on Ubuntu 22.04.

# Results

| |RadonKA.jl CPU | RadonKA.jl GPU | Matlab CPU | Astra CPU | Astra GPU |
|-------------------|---------------|-------------------|------------|-----------|-----------|
|2D sample - Radon |1.1s |0.07s |0.39s |7.0s |0.025s |
|2D sample - Backprojection |1.4s |0.50s |0.37s |6.4s |N/A |
|3D sample - Radon |7.4s |0.28s |9.01s |N/A |1.12s |
|3D sample - Backprojection |7.9s |0.53s |3.24s |N/A |N/A |
| |RadonKA.jl CPU | RadonKA.jl CUDA | Matlab CPU | Astra CPU | Astra CUDA |torch-radon CUDA|
|-------------------------------|---------------|-------------------|------------|-----------|-----------|----------------|
|2D sample - Radon |1.1s |0.07s |0.39s |7.0s |0.025s |0.011s |
|2D sample - Backprojection |1.4s |0.50s |0.37s |6.4s |N/A |0.008s |
|3D sample - Radon |7.4s |0.28s |9.01s |N/A |1.12s |0.062s |
|3D sample - Backprojection |7.9s |0.53s |3.24s |N/A |N/A |0.063s |



Expand Down Expand Up @@ -52,6 +52,48 @@ Tested on a AMD Ryzen 9 5900X 12-Core Processor with 24 Threads and a NVIDIA GeF
![](../assets/radonka_backproject.png)


## torch-radon
```python
import torch
import torch_radon


volume = torch_radon.volumes.Volume2D()
angles = torch.tensor(np.linspace(0, 2*np.pi, 500), dtype=torch.float32, device="cuda")
sample = torch.rand(1,1920, 1920, device="cuda")
radon = torch_radon.ParallelBeam(volume=volume, angles=angles, det_spacing=1.0, det_count=1920)


%%timeit
radon.forward(sample)
torch.cuda.synchronize()

sinogram = radon.forward(sample)

%%timeit
radon.backward(sinogram)
torch.cuda.synchronize()



angles = torch.tensor(np.linspace(0, 2*np.pi, 500), dtype=torch.float32, device="cuda")
sample = torch.rand(100, 512, 512, device="cuda")
radon = torch_radon.ParallelBeam(volume=volume, angles=angles, det_spacing=1.0, det_count=512)


%%timeit
radon.forward(sample)
torch.cuda.synchronize()

sinogram = radon.forward(sample)

%%timeit
radon.backward(sinogram)
torch.cuda.synchronize()
```



## Matlab (R2023a)
```matlab
arr = single(imread("/tmp/sample.jpg"));
Expand Down Expand Up @@ -158,7 +200,7 @@ np.copy(proj_data)

rec_id = astra.data3d.create('-vol', vol_geom)

# Set up the parameters for a reconstruction algorithm using the GPU
# Set up the parameters for a reconstruction algorithm using the CUDA
cfg = astra.astra_dict('BP3D_CUDA')
cfg['ReconstructionDataId'] = rec_id
cfg['ProjectionDataId'] = proj_id
Expand Down

0 comments on commit bfa7919

Please sign in to comment.