Skip to content

Commit 9ac471b

Browse files
authored
More tests for CuArrayPtr (#2760)
1 parent c113666 commit 9ac471b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/base/texture.jl

+10
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ end
6969
@test length(array_mem) == length(d_a3D)
7070
@test ndims(array_mem) == ndims(d_a3D)
7171

72+
# and its CuArrayPtr
73+
ptr = convert(CUDA.CuArrayPtr{Float32}, array_mem)
74+
@test isequal(ptr, ptr)
75+
@test isless(ptr, 2 + ptr)
76+
@test isless(ptr - 2, ptr)
77+
@test ptr == ptr
78+
@test ptr - 2 < ptr
79+
@test eltype(ptr) == Float32
80+
@test convert(UInt64, ptr) == UInt64(UInt(ptr))
81+
@test_throws ArgumentError("cannot convert a GPU array pointer to a CPU pointer") convert(Ptr{Float32}, ptr)
7282
end
7383

7484
@testset "CuTextureArray(::Array)" begin

0 commit comments

Comments
 (0)