Skip to content

Commit

Permalink
Fix deprecated array constructor syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored and vchuravy committed Feb 17, 2017
1 parent 4e89eb7 commit 8e0a006
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ using CUDArt
export function1

const ptxdict = Dict()
const mdlist = Array(CuModule, 0)
const mdlist = Array{CuModule}(0)

function mdinit(devlist)
global ptxdict
Expand Down Expand Up @@ -317,7 +317,7 @@ demonstration that activates processing on multiple devices:
```
measured_sleep_time = CUDArt.devices(dev->true, nmax=2) do devlist
sleeptime = 0.5
results = Array(Float64, 3*length(devlist))
results = Array{Float64}(3*length(devlist))
streams = [(device(dev); Stream()) for dev in devlist]
# Force one run to precompile
cudasleep(sleeptime; dev=devlist[1], stream=streams[1])
Expand Down
8 changes: 4 additions & 4 deletions src/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ device(A::AbstractArray) = -1 # for host

pointer(g::AbstractCudaArray) = g.ptr

to_host{T}(g::AbstractCudaArray{T}) = copy!(Array(T, size(g)), g)
to_host{T}(g::AbstractCudaArray{T}) = copy!(Array{T}(size(g)), g)

summary(g::AbstractCudaArray) = string(g)

Expand Down Expand Up @@ -160,7 +160,7 @@ function _copy!{T}(dst::ContiguousArray{T}, src::ContiguousArray{T}, stream)
return dst
end
_copy!{T}(dst::ContiguousArray{T}, src::ContiguousArray, stream) = _copy!(dst, to_eltype(T, src), stream)
_copy!{T}(dst::AbstractCudaArray{T}, src, stream) = _copy!(dst, copy!(Array(T, size(src)), src), stream)
_copy!{T}(dst::AbstractCudaArray{T}, src, stream) = _copy!(dst, copy!(Array{T}(size(src)), src), stream)

function fill!{T}(X::CudaArray{T}, val; stream=null_stream)
valT = convert(T, val)
Expand All @@ -181,7 +181,7 @@ CudaPitchedArray(T::Type, dims::Integer...) = CudaPitchedArray(T, dims)
function CudaPitchedArray(T::Type, dims::Dims)
nd = length(dims)
1 <= nd <= 3 || error("Supports only dimensions 1, 2, or 3")
p = Array(rt.cudaPitchedPtr, 1)
p = Array{rt.cudaPitchedPtr}(1)
ext = CudaExtent(T, dims)
rt.cudaMalloc3D(p, ext)
pp = p[1]
Expand Down Expand Up @@ -402,7 +402,7 @@ function free(ha::HostArray)
if ha.ptr != C_NULL && haskey(cuda_ptrs, ha.ptr)
rt.cudaFreeHost(ha.ptr)
ha.ptr = C_NULL
ha.data = Array(eltype(ha), ntuple(d->0, ndims(ha)))
ha.data = Array{eltype(ha)}(ntuple(d->0, ndims(ha)))
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/device.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end

device_synchronize() = rt.cudaDeviceSynchronize()

device_properties(dev::Integer) = (aprop = Array(rt.cudaDeviceProp, 1); rt.cudaGetDeviceProperties(aprop, dev); aprop[1])
device_properties(dev::Integer) = (aprop = Array{rt.cudaDeviceProp}(1); rt.cudaGetDeviceProperties(aprop, dev); aprop[1])

attribute(dev::Integer, code::Integer) = (ret = Cint[0]; rt.cudaDeviceGetAttribute(ret, code, dev); Int(ret[1]))

Expand Down
2 changes: 1 addition & 1 deletion src/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Stream <: AbstractStream
c::Condition
end
function Stream()
p = Array(Ptr{Void}, 1)
p = Array{Ptr{Void}}(1)
rt.cudaStreamCreate(p)
hnd = CuStream(p[1])
Stream(hnd, Condition())
Expand Down
2 changes: 1 addition & 1 deletion test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ gc() # check for finalizer errors
if CUDArt.devcount() > 1
CUDArt.devices(dev->true, nmax=2) do devlist
sleeptime = 0.5
results = Array(Any, ceil(Int, 2.5*length(devlist)))
results = Array{Any}(ceil(Int, 2.5*length(devlist)))
streams = [(CUDArt.device(dev); CUDArt.Stream()) for dev in devlist]
# Force one run to precompile
CUDArt.cudasleep(sleeptime; dev=devlist[1], stream=streams[1])
Expand Down

0 comments on commit 8e0a006

Please sign in to comment.