Is there any abstract type that is a catch-all for GPU arrays? I want to use multiple dispatch on some function that works on Metal or CUDA or AMDGPU and on the CPU works slightly differently. E.g.
function foo(f::AbstractArray)
return f .+ 1
end
function foo(f::GPUArray)
return f .+ 2
end
I could rewrite the functions for all of the GPU backends but that seems like a pain if it's not needed
function foo(f::MtlArray)
return f .+ 2
end
function foo(f::CuArray)
return f .+ 2
end
...
I think you want https://docs.juliahub.com/GPUArraysCore/qiYUe/0.1.2/autodocs/#GPUArraysCore.AbstractGPUArray
I’m away from my computer right now but that looks like it’s exactly what I want
Last updated: Nov 06 2024 at 04:40 UTC