-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from lmejn/feature/CUDA-ext
CUDA Extension
- Loading branch information
Showing
7 changed files
with
41 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module RoentgenCUDAExt | ||
|
||
using Roentgen | ||
|
||
import Roentgen.AbstractBeamlet, Roentgen.AbstractExternalSurface, Roentgen.AbstractDoseAlgorithm | ||
|
||
using CUDA | ||
import Adapt | ||
|
||
function dose_fluence_matrix(::Type{CuArray}, pos, beamlets::AbstractArray{<:AbstractBeamlet}, | ||
surf::AbstractExternalSurface, calc::AbstractDoseAlgorithm; kwargs...) | ||
D = CUDA.zeros(length(pos), length(beamlets)) | ||
dose_fluence_matrix!(D, pos, beamlets, surf, calc; kwargs...) | ||
end | ||
|
||
function dose_fluence_matrix!(D::CuArray, pos, beamlets::AbstractArray{<:AbstractBeamlet}, | ||
surf::AbstractExternalSurface, calc::AbstractDoseAlgorithm; | ||
maxradius=100.) | ||
_assert_size(D, pos, beamlets) | ||
D .= point_dose.(vec(pos), permutedims(vec(beamlets)), Ref(surf), Ref(calc), maxradius) | ||
end | ||
|
||
function Adapt.adapt_structure(to, surf::CylindricalSurface) | ||
cu_rho = Adapt.adapt_structure(to, surf.rho) | ||
CylindricalSurface(surf.y, surf.ϕ, cu_rho) | ||
end | ||
|
||
Adapt.@adapt_structure DoseVolume | ||
Adapt.@adapt_structure LinearSurface | ||
Adapt.@adapt_structure FinitePencilBeamKernel | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters