Skip to content

Commit 4c0c6da

Browse files
authored
add CPU definition.
1 parent bdb7ad9 commit 4c0c6da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cpu.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
synchronize(::CPU) = nothing
22

3-
allocate(::CPU, ::Type{T}, dims::Tuple) where {T} = Array{T}(undef, dims)
3+
allocate(::CPU, ::Type{T}, dims::Tupl; unified::Bool=false) where {T} = Array{T}(undef, dims)
44

5-
function zeros(backend::CPU, ::Type{T}, dims::Tuple) where {T}
6-
arr = allocate(backend, T, dims)
5+
function zeros(backend::CPU, ::Type{T}, dims::Tuple, kwargs...) where {T}
6+
arr = allocate(backend, T, dims; kwargs...)
77
kernel = init_kernel(backend)
88
kernel(arr, zero, T, ndrange = length(arr))
99
return arr
1010
end
11-
function ones(backend::CPU, ::Type{T}, dims::Tuple) where {T}
12-
arr = allocate(backend, T, dims)
11+
function ones(backend::CPU, ::Type{T}, dims::Tuple, kwargs...) where {T}
12+
arr = allocate(backend, T, dims; kwargs...)
1313
kernel = init_kernel(backend)
1414
kernel(arr, one, T; ndrange = length(arr))
1515
return arr
@@ -33,6 +33,7 @@ end
3333

3434
functional(::CPU) = true
3535
pagelock!(::CPU, x) = nothing
36+
supports_unified(::CPU) = true
3637

3738
function (obj::Kernel{CPU})(args...; ndrange = nothing, workgroupsize = nothing)
3839
ndrange, workgroupsize, iterspace, dynamic = launch_config(obj, ndrange, workgroupsize)

0 commit comments

Comments
 (0)