# Difference between GPUArrays.jl and KernelAbstractations.jl

**URL:** <https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457>\
**Category:** GPU\
**Tags:** gpuarrays, kernelabstractions\
**Created:** [June 11, 2024, 7:22am UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457 "2024-06-11T07:22:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [June 11, 2024, 7:22am UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457/1 "2024-06-11T07:22:43Z")

</div>

Hello,

I would like to implement some simple matrix-vector multiplication, when none of them are strided arrays (e.g., `@view(A[[1, 4, 5], 1:10])`). Standard `LinearAlgebra.mul!` doesn’t support these arrays, so I thought to implement the kernel from scratch. It shouldn’t be too difficult.

I saw that in the CUDA.jl package it calls `GPUArrays` for non-symmetric and non-hermitian matrices. So, I think that I should first define the kernel in that package, right?

But then, I saw that there is also the KernelAbstractions.jl package, which, again, is able to define generic kernels for any platform.

I guess that I should implement this functionality in GPUArrays.jl, but what is the difference?

KernelAbstractions.jl seems to be something just for defining kernels for any platform, while GPUArrays seems to define the linear algebra behind these objects. But it seems that GPUArrays.jl has its own method to define generic kernels, why doesn’t include KernelAbstractions.jl to define these kernel?

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [June 11, 2024, 4:53pm UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457/2 "2024-06-11T16:53:55Z")

</div>

> [@albertomercurio](#):
>
> But it seems that [GPUArrays.jl](https://juliahub.com/ui/Packages/General/GPUArrays) has its own method to define generic kernels, why doesn’t include [KernelAbstractions.jl](https://juliahub.com/ui/Packages/General/KernelAbstractions) to define these kernel?

GPUArrays.jl predates KernelAbstractions.jl. @leios is working on porting the GPUArrays.jl kernels to KernelAbstractions.jl: [KernelAbstractions version of GPUArrays by leios · Pull Request #525 · JuliaGPU/GPUArrays.jl · GitHub](https://github.com/JuliaGPU/GPUArrays.jl/pull/525)

---

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [June 12, 2024, 1:32pm UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457/3 "2024-06-12T13:32:13Z")

</div>

Do you mean the opposit? Moving KernelAbstractions.jl to GPUArrays.jl kernels? I see in the PR that @leios is introducing KernelAbstractions.jl into GPUArrays.jl

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [June 12, 2024, 1:49pm UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457/4 "2024-06-12T13:49:40Z")

</div>

Right, so porting the GPUArrays kernels to the KernelAbstractions.jl DSL. There’s no moving of packages, both will keep existing.

---

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [June 12, 2024, 2:17pm UTC](https://discourse.julialang.org/t/difference-between-gpuarrays-jl-and-kernelabstractations-jl/115457/5 "2024-06-12T14:17:50Z")

</div>

Ok, so I will start to implement the `mul!` function for non-strided arrays using KernelAbstractions.jl kernels, and then making a PR to GPUArrays.jl when the @leios ’s PR will be merged.
