-
Notifications
You must be signed in to change notification settings - Fork 10
Added support for CuArray via Adapt.jl #67
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
Closed
RainerHeintzmann
wants to merge
9
commits into
JuliaArrays:master
from
RainerHeintzmann:CUDA_extension_support
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aec3bf2
Added support for CuArray via Adapt.jl
RainerHeintzmann dee9144
Update ext/CUDASupportExt.jl
RainerHeintzmann 2f751c0
Update ext/CUDASupportExt.jl
RainerHeintzmann 6fc77cd
Update ext/CUDASupportExt.jl
RainerHeintzmann 52a28d1
bug fixes
RainerHeintzmann ec23e5a
put the use_cuda back to false as default
RainerHeintzmann 2ad32e9
upgraded to a recent CUDA Version (5.2+), where the BroadcastStyle ch…
RainerHeintzmann 9e9fdfb
set cuda to false
RainerHeintzmann ff5a85d
Bug fix with CUDASupportExt
RainerHeintzmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,27 @@ | ||
module CUDASupportExt | ||
using CUDA | ||
using Adapt | ||
using ShiftedArrays | ||
using Base # to allow displaying such arrays without causing the single indexing CUDA error | ||
|
||
Adapt.adapt_structure(to, x::CircShiftedArray{T, D}) where {T, D} = CircShiftedArray(adapt(to, parent(x)), shifts(x)); | ||
parent_type(::Type{CircShiftedArray{T, N, S}}) where {T, N, S} = S | ||
Base.Broadcast.BroadcastStyle(::Type{T}) where {T<:CircShiftedArray} = Base.Broadcast.BroadcastStyle(parent_type(T)) | ||
|
||
# cu_storage_type(::Type{T}) where {CT,CN,CD,T<:CuArray{CT,CN,CD}} = CD | ||
# lets do this for the ShiftedArray type | ||
Adapt.adapt_structure(to, x::ShiftedArray{T, M, N}) where {T, M, N} = ShiftedArray(adapt(to, parent(x)), shifts(x); default=ShiftedArrays.default(x)); | ||
|
||
# function Base.Broadcast.BroadcastStyle(::Type{T}) where (CT,CN,CD,T<: ShiftedArray{<:Any,<:Any,<:Any,<:CuArray}) | ||
function Base.Broadcast.BroadcastStyle(::Type{T}) where {T2, N, CD, T<:ShiftedArray{<:Any,<:Any,<:Any,<:CuArray{T2,N,CD}}} | ||
CUDA.CuArrayStyle{N,CD}() | ||
end | ||
|
||
# function Base.show(io::IO, mm::MIME"text/plain", cs::CircShiftedArray) | ||
# CUDA.@allowscalar invoke(Base.show, Tuple{IO, typeof(mm), AbstractArray}, io, mm, cs) | ||
# end | ||
|
||
# function Base.show(io::IO, mm::MIME"text/plain", cs::ShiftedArray) | ||
# CUDA.@allowscalar invoke(Base.show, Tuple{IO, typeof(mm), AbstractArray}, io, mm, cs) | ||
# end | ||
end |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.