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

Make compatible with CUDA v4 #19

Merged
merged 8 commits into from
May 17, 2023
Merged
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 Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
[compat]
Adapt = "3"
AMDGPU = "0.3.7, 0.4"
CUDA = "3.12"
CUDA = "3.12, 4"
julia = "1.7"
StaticArrays = "1"

Expand Down
2 changes: 1 addition & 1 deletion src/CellArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct CellArray{T<:Cell,N,B,T_array<:AbstractArray{T_elem,_N} where {T_elem}} <
CellArray{T,0}(T_arraykind, undef, dims)
end

function CellArray{T}(::Type{T_arraykind}, ::UndefInitializer, dims::Int...) where {T<:Cell,N,T_arraykind<:AbstractArray} #where {Type{T_arraykind}<:UnionAll}
function CellArray{T}(::Type{T_arraykind}, ::UndefInitializer, dims::Int...) where {T<:Cell,T_arraykind<:AbstractArray} #where {Type{T_arraykind}<:UnionAll}
CellArray{T}(T_arraykind, undef, dims)
end
end
Expand Down
12 changes: 6 additions & 6 deletions test/test_CellArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ end
end;
@testset "fill!" begin
allowscalar(true)
fill!(A, 9); @test all(A.data .== 9.0)
fill!(B, 9.0); @test all(B.data .== 9)
fill!(A, 9); @test all(Base.Array(A.data) .== 9.0)
fill!(B, 9.0); @test all(Base.Array(B.data) .== 9)
fill!(C, (1:length(eltype(C)))); @test all(C .== (T_Float64(1:length(eltype(C))) for i=1:dims[1], j=1:dims[2]))
fill!(D, (1:length(eltype(D)))); @test all(D .== (T_Int32(1:length(eltype(D))) for i=1:dims[1], j=1:dims[2]))
fill!(E, (1:length(eltype(E)))); @test all(E .== (T2_Float64(1:length(eltype(E))) for i=1:dims[1], j=1:dims[2]))
Expand Down Expand Up @@ -248,9 +248,9 @@ end
A[ix,iy] = A[ix,iy] * A[ix,iy];
return
end
A.data.=3; @cuda blocks=size(A) matsquare2D_CUDA!(A); synchronize(); @test all(A.data .== 9)
A.data.=3; @cuda blocks=size(A) matsquare2D_CUDA!(A); synchronize(); @test all(Base.Array(A.data) .== 9)
J.data.=3; J_ref.data.=36; @cuda blocks=size(J) matsquare2D_CUDA!(J); synchronize(); @test CUDA.@allowscalar all(J .== J_ref)
C.data.=2; G.data.=3; @cuda blocks=size(C) add2D_CUDA!(C, G); synchronize(); @test all(C.data .== 5)
C.data.=2; G.data.=3; @cuda blocks=size(C) add2D_CUDA!(C, G); synchronize(); @test all(Base.Array(C.data) .== 5)
end
if array_type == "AMDGPU"
function add2D_AMDGPU!(A, B)
Expand All @@ -265,9 +265,9 @@ end
A[ix,iy] = A[ix,iy] * A[ix,iy];
return
end
A.data.=3; wait(@roc gridsize=size(A) matsquare2D_AMDGPU!(A)); @test all(A.data .== 9)
A.data.=3; wait(@roc gridsize=size(A) matsquare2D_AMDGPU!(A)); @test all(Base.Array(A.data) .== 9)
J.data.=3; J_ref.data.=36; wait(@roc gridsize=size(J) matsquare2D_AMDGPU!(J)); @test AMDGPU.@allowscalar all(J .== J_ref)
C.data.=2; G.data.=3; wait(@roc gridsize=size(C) add2D_AMDGPU!(C, G)); @test all(C.data .== 5)
C.data.=2; G.data.=3; wait(@roc gridsize=size(C) add2D_AMDGPU!(C, G)); @test all(Base.Array(C.data) .== 5)
end
end;
@testset "cellsize" begin
Expand Down