Skip to content

Commit 332659b

Browse files
committed
2 parents 59be95a + d98ca89 commit 332659b

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1010
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1111
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
13+
14+
[extras]
15+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
16+
17+
[targets]
18+
test = ["Pkg"]

src/abstractarray.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ end
5656

5757
## showing
5858

59-
Base.print_array(io::IO, x::GPUArray) = Base.print_array(io, collect(x))
60-
Base.print_array(io::IO, x::LinearAlgebra.Adjoint{<:Any,<:GPUArray}) = Base.print_array(io, LinearAlgebra.adjoint(collect(x.parent)))
61-
Base.print_array(io::IO, x::LinearAlgebra.Transpose{<:Any,<:GPUArray}) = Base.print_array(io, LinearAlgebra.transpose(collect(x.parent)))
59+
Base.show(io::IO, x::GPUArray) = Base.show(io, Array(x))
60+
Base.show(io::IO, x::LinearAlgebra.Adjoint{<:Any,<:GPUArray}) =
61+
Base.show(io, LinearAlgebra.adjoint(Array(x.parent)))
62+
Base.show(io::IO, x::LinearAlgebra.Transpose{<:Any,<:GPUArray}) =
63+
Base.show(io, LinearAlgebra.transpose(Array(x.parent)))
64+
65+
Base.show_vector(io::IO, x::GPUArray) = Base.show_vector(io, Array(x))
6266

6367

6468
# memory operations

test/runtests.jl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
11
using GPUArrays, Test
22
using GPUArrays.TestSuite
33

4+
using Pkg
45

5-
@testset "Julia reference implementation:" begin
6+
@testset "JLArray" begin
67
GPUArrays.test(JLArray)
78
end
9+
10+
function test_package(package, branch=nothing)
11+
mktempdir() do devdir
12+
withenv("JULIA_PKG_DEVDIR" => devdir) do
13+
# try to install from the same branch of GPUArrays
14+
try
15+
if branch === nothing
16+
branch = chomp(read(`git -C $(@__DIR__) rev-parse --abbrev-ref HEAD`, String))
17+
branch == "HEAD" && error("in detached HEAD state")
18+
end
19+
Pkg.add(PackageSpec(name=package, rev=String(branch)))
20+
@info "Installed $package from $branch branch"
21+
catch ex
22+
@warn "Could not install $package from same branch as GPUArrays, trying master branch" exception=ex
23+
Pkg.add(PackageSpec(name=package, rev="master"))
24+
end
25+
26+
Pkg.test(package)
27+
end
28+
end
29+
end
30+
31+
if haskey(ENV, "GITLAB_CI")
32+
branch = ENV["CI_COMMIT_REF_NAME"]
33+
@testset "CuArray" begin
34+
test_package("CuArrays", branch)
35+
end
36+
end

0 commit comments

Comments
 (0)