# Dot operators of hcat failed for CuArray

**URL:** <https://discourse.julialang.org/t/dot-operators-of-hcat-failed-for-cuarray/51174>\
**Category:** General Usage\
**Tags:** question, cuda\
**Created:** [December 3, 2020, 7:59am UTC](https://discourse.julialang.org/t/dot-operators-of-hcat-failed-for-cuarray/51174 "2020-12-03T07:59:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zqn](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@zqn](https://discourse.julialang.org/u/zqn)\
**Post date:** [December 3, 2020, 7:59am UTC](https://discourse.julialang.org/t/dot-operators-of-hcat-failed-for-cuarray/51174/1 "2020-12-03T07:59:21Z")

</div>

Hi.

I’m trying to combining elements with the same locations from two arrays. It’s easy to do that with dot hcat like this.

```julia
a = randn(5,2)
b = randn(5,2)
hcat.(a,b)

```

When I store my arrays in GPU as CuArray, it won’t work, and seems that element-wise procedure could be done in CPU only.

```julia
a = gpu(randn(5,2))
b = gpu(randn(5,2))
hcat.(a,b)

```

I was wondering whether I missed anything here and many thanks for any advices.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [December 3, 2020, 9:21am UTC](https://discourse.julialang.org/t/dot-operators-of-hcat-failed-for-cuarray/51174/2 "2020-12-03T09:21:47Z")

</div>

This makes a `5×2 Matrix{Matrix{Float64}}`. I don’t think arrays of arrays work well on the GPU, can you use `tuple.(a,b)` or `cat(a,b; dims=3)` instead?

---

<div class="post-metadata">

**Author:** ![zqn](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@zqn](https://discourse.julialang.org/u/zqn)\
**Post date:** [December 5, 2020, 4:22am UTC](https://discourse.julialang.org/t/dot-operators-of-hcat-failed-for-cuarray/51174/3 "2020-12-05T04:22:07Z")

</div>

Many thanks for your suggestions and I just realized that arrays of arrays won’t work on the GPU.
