# How does one create a GPU array from an Array

**URL:** <https://discourse.julialang.org/t/how-does-one-create-a-gpu-array-from-an-array/102247>\
**Category:** General Usage\
**Tags:** gpu, kernelabstractions\
**Created:** [July 29, 2023, 6:02pm UTC](https://discourse.julialang.org/t/how-does-one-create-a-gpu-array-from-an-array/102247 "2023-07-29T18:02:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![berk.geveci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/berk.geveci/32/51853_2.png) [@berk.geveci](https://discourse.julialang.org/u/berk.geveci)\
**Post date:** [July 29, 2023, 6:02pm UTC](https://discourse.julialang.org/t/how-does-one-create-a-gpu-array-from-an-array/102247/1 "2023-07-29T18:02:39Z")

</div>

Hi folks,  
I apologize for this basic question but I have not been able to resolve this by going through the documentation. How does one create a GPU array from an Array using KernelAbstractions? Similar to `CuArray(array)`? In the 2021 JuliaCon tutorial there are references to a `GpuArray` function but that does not seem to be part of the API anymore. The only way I can see doing this now is to use `alllocate()` and then `copyto!()`. Is this the best way?  
Thanks.

---

<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:** [July 29, 2023, 6:42pm UTC](https://discourse.julialang.org/t/how-does-one-create-a-gpu-array-from-an-array/102247/2 "2023-07-29T18:42:07Z")

</div>

`adapt(backend, array)` should work. otherwise `allocate` + `copyto!` indeed.
