# Matrix manipulation over two GPUs

**URL:** <https://discuss.pytorch.org/t/matrix-manipulation-over-two-gpus/9220>\
**Category:** Uncategorized\
**Created:** [October 29, 2017, 11:45am UTC](https://discuss.pytorch.org/t/matrix-manipulation-over-two-gpus/9220 "2017-10-29T11:45:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![milani](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/milani/32/2060_2.png) [@milani](https://discuss.pytorch.org/u/milani)\
**Post date:** [October 29, 2017, 11:45am UTC](https://discuss.pytorch.org/t/matrix-manipulation-over-two-gpus/9220/1 "2017-10-29T11:45:57Z")

</div>

I have a big numpy 2d array (30884x30884) that takes 7GB of memory. I want to do a few matrix manipulations such as calculating the inverse using pytorch. I have two nvidia 1080ti (each with 11GB memory). So I thought the following would work:

```auto
G_tensor = torch.from_numpy(G).cuda(device=0)
G_inverse = torch.DoubleTensor().cuda(device=1)
torch.inverse(G_tensor,out=G_inverse)

```

~~But I get the following error:~~

```auto
~~TypeError: torch.inverse received an invalid combination of arguments - got (torch.cuda.DoubleTensor, torch.cuda.DoubleTensor), but expected (torch.cuda.DoubleTensor source)~~

```

How can I utilize both GPUs to avoid running out of memory?

UPDATE:  
I needed to pass named argument `out`. Still, it does not work the way I assumed.
