From 72c200041397dd27dd2e586faa70926925f14d41 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Fri, 29 Sep 2017 16:07:30 +0200 Subject: [PATCH] add shorthands --- src/array.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/array.jl b/src/array.jl index d89b2c4..9b8ded7 100644 --- a/src/array.jl +++ b/src/array.jl @@ -24,6 +24,14 @@ size(x::CLArray) = Int.(x.size) pointer(x::CLArray) = x.ptr context(p::CLArray) = context(pointer(p)) +# Avoid conflict with OpenCL.cl +module Shorthands + using ..CLArrays + cl(x) = x + cl(x::CLArrays.CLArray) = x + cl(xs::AbstractArray) = isbits(xs) ? xs : CLArrays.CLArray(xs) +end + function (::Type{CLArray{T, N}})(size::NTuple{N, Integer}, ctx = global_context()) where {T, N} # element type has different padding from cl type in julia # for fixedsize arrays we use vload/vstore, so we can use it packed