Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/array.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export CuArray, CuVector, CuMatrix, CuVecOrMat, cu, is_device, is_unified, is_host
export CuArray, CuScalar, CuVector, CuMatrix, CuVecOrMat, cu, is_device, is_unified, is_host


## array type
Expand Down Expand Up @@ -123,6 +123,7 @@ end

## convenience constructors

const CuScalar{T} = CuArray{T,0}
const CuVector{T} = CuArray{T,1}
const CuMatrix{T} = CuArray{T,2}
const CuVecOrMat{T} = Union{CuVector{T},CuMatrix{T}}
Expand Down Expand Up @@ -371,7 +372,7 @@ is_host(a::CuArray) = memory_type(a) == HostMemory

export DenseCuArray, DenseCuVector, DenseCuMatrix, DenseCuVecOrMat,
StridedCuArray, StridedCuVector, StridedCuMatrix, StridedCuVecOrMat,
AnyCuArray, AnyCuVector, AnyCuMatrix, AnyCuVecOrMat
AnyCuArray, AnyCuScalar, AnyCuVector, AnyCuMatrix, AnyCuVecOrMat

# dense arrays: stored contiguously in memory
#
Expand Down Expand Up @@ -426,6 +427,7 @@ end

# anything that's (secretly) backed by a CuArray
const AnyCuArray{T,N} = Union{CuArray{T,N}, WrappedArray{T,N,CuArray,CuArray{T,N}}}
const AnyCuScalar{T} = AnyCuArray{T,0}
const AnyCuVector{T} = AnyCuArray{T,1}
const AnyCuMatrix{T} = AnyCuArray{T,2}
const AnyCuVecOrMat{T} = Union{AnyCuVector{T}, AnyCuMatrix{T}}
Expand Down
15 changes: 12 additions & 3 deletions src/device/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ struct CuDeviceArray{T,N,A} <: DenseArray{T,N}
new(ptr, maxsize, dims, prod(dims))
end

const CuDeviceVector = CuDeviceArray{T,1,A} where {T,A}
const CuDeviceMatrix = CuDeviceArray{T,2,A} where {T,A}

const CuDeviceScalar{T} = CuDeviceArray{T,0,A} where {A}
const CuDeviceVector{T} = CuDeviceArray{T,1,A} where {A}
const CuDeviceMatrix{T} = CuDeviceArray{T,2,A} where {A}

# anything that's (secretly) backed by a CuDeviceArray
export AnyCuDeviceArray, AnyCuDeviceScalar, AnyCuDeviceVector, AnyCuDeviceMatrix, AnyCuDeviceVecOrMat

const AnyCuDeviceArray{T,N} = Union{CuDeviceArray{T,N},WrappedArray{T,N,CuDeviceArray,CuDeviceArray{T,N,A}}} where {A}
const AnyCuDeviceScalar{T} = AnyCuDeviceArray{T,0}
const AnyCuDeviceVector{T} = AnyCuDeviceArray{T,1}
const AnyCuDeviceMatrix{T} = AnyCuDeviceArray{T,2}
const AnyCuDeviceVecOrMat{T} = Union{AnyCuDeviceVector{T},AnyCuDeviceMatrix{T}}

## array interface

Expand Down