# Can we accelerate functions from other packages using juliaGPU package?

**URL:** <https://discourse.julialang.org/t/can-we-accelerate-functions-from-other-packages-using-juliagpu-package/113587>\
**Category:** GPU\
**Created:** [April 28, 2024, 3:38pm UTC](https://discourse.julialang.org/t/can-we-accelerate-functions-from-other-packages-using-juliagpu-package/113587 "2024-04-28T15:38:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjk](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@tjk](https://discourse.julialang.org/u/tjk)\
**Post date:** [April 28, 2024, 3:38pm UTC](https://discourse.julialang.org/t/can-we-accelerate-functions-from-other-packages-using-juliagpu-package/113587/1 "2024-04-28T15:38:08Z")

</div>

Hello,

I want to accelerate functions imported from other julia packages. In the past, I always use

```julia
using Distributed
addprocs(Num)

```

To accelerate computation, and what I need to do is just write the functions and execute it. In fact, I don’t need to do anything special about it.

I am new to juliaGPU and what I want to know is: If I am importing an external function from outside packages, for example funCPU(a,b), and I want to do is use juliaGPU to accelerate it. How can I achieve that? Since this function is write in outside packages and defined in CPU code.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [April 28, 2024, 10:27pm UTC](https://discourse.julialang.org/t/can-we-accelerate-functions-from-other-packages-using-juliagpu-package/113587/2 "2024-04-28T22:27:15Z")

</div>

> [@tjk](#):
>
> If I am importing an external function from outside packages, for example funCPU(a,b), and I want to do is use juliaGPU to accelerate it. How can I achieve that? Since this function is write in outside packages and defined in CPU code.

In Julia, the GPU or CPU location is encoded in the type of an array. For instance, a `CuArray` from CUDA.jl lives on an NVIDIA GPU. So if you have a function generic enough to accept arbitrary array types, then applying it to a `CuArray` will _just work_.

---

<div class="post-metadata">

**Author:** ![tjk](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@tjk](https://discourse.julialang.org/u/tjk)\
**Post date:** [April 29, 2024, 11:03am UTC](https://discourse.julialang.org/t/can-we-accelerate-functions-from-other-packages-using-juliagpu-package/113587/3 "2024-04-29T11:03:15Z")

</div>

Many thanks for that, I will have a try!
