CuArray dot fuction error


#1

I am playing around some code to run on GPU. I encountered the following error. Here is a MWE.

julia> B = rand(100, 100, 2)
julia> B_g = cu(B)
julia> B_gv = reshape(B_g, 10000, 2)

julia> dot(view(B_g, :, :, 1), view(B_g, :, :, 1))
3356.4253f0

julia> dot(view(B_gv, :, 1), view(B_gv, :, 1))
ERROR: conversion to pointer not defined for CuArray{Float32,2}
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] unsafe_convert(::Type{Ptr{Float32}}, ::CuArray{Float32,2}) at ./pointer.jl:67
 [3] unsafe_convert(::Type{Ptr{Float32}}, ::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at ./subarray.jl:337
 [4] pointer(::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at ./abstractarray.jl:858
 [5] macro expansion at ./gcutils.jl:87 [inlined]
 [6] dot(::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}, ::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/zhu/julia/usr/share/julia/stdlib/v1.0/LinearAlgebra/src/blas.jl:334
 [7] dot(::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}, ::SubArray{Float32,1,CuArray{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/zhu/julia/usr/share/julia/stdlib/v1.0/LinearAlgebra/src/matmul.jl:9
 [8] top-level scope at none:0

I don’t understand why the first dot worked, but the second didn’t.

Julia version is 1.0.3 and CuArrays version is 0.8.1.


#2

Works on master.


#3

Thanks! I confirm that it works on 1.1.0-rc2.