# Memory problems that occur when computing with ITensor

**URL:** <https://itensor.discourse.group/t/memory-problems-that-occur-when-computing-with-itensor/347>\
**Category:** ITensor C++ Questions\
**Tags:** cpp\
**Created:** [August 15, 2022, 9:56am UTC](https://itensor.discourse.group/t/memory-problems-that-occur-when-computing-with-itensor/347 "2022-08-15T09:56:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanghao123th](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/tanghao123th/32/137_2.png) [@tanghao123th](https://itensor.discourse.group/u/tanghao123th)\
**Post date:** [August 15, 2022, 9:56am UTC](https://itensor.discourse.group/t/memory-problems-that-occur-when-computing-with-itensor/347/1 "2022-08-15T09:56:03Z")

</div>

Excuse me,When I use itensor (C++ version) to implement a simple addition calculation of two tensors, the problem appears as shown below:

 ![image](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/2b41fa070fd48e9f74c9d930b96c647f4809cf7c.png)

```nohighlight
using ITensors
auto i = Index(1480"index i");
auto j = Index(1860"index j");
auto k = Index(1400,"index k");
auto m = Index(1000,"index m");
 A = randomITensor(i,j,k,m);
 B = randomITensor(i,j,k,m);

start = clock();
C = A+B;
end = clock();
std::cout << "consuming time is : " << (double)(end - start) / CLOCKS_PER_SEC << "s" << std::endl;

```

Is this because the size of two tensor is too big? If I want to do a simple calculation on two large tensor, how should I do it?

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [August 16, 2022, 1:45pm UTC](https://itensor.discourse.group/t/memory-problems-that-occur-when-computing-with-itensor/347/2 "2022-08-16T13:45:03Z")

</div>

The tensors you are creating are `1480 * 1860 * 1400 * 1000 * 8 = 30831360000000` bytes or about `1480 * 1860 * 1400 * 1000 * 8 / 10^12 = 30.8` terabytes, so wouldn’t fit in memory on a single computer. Working directly with such large tensors would require specialized libraries like [Cyclops](https://solomon2.web.engr.illinois.edu/ctf/) or [TiledArray](https://valeevgroup.github.io/software/tiledarray/master/doc/html/index.html) which can distribute large tensors across many computers. However, you may be able to compress these tensors if they have some low rank structure. Where are these tensors coming from and what are you trying to do with them?
