Memory problems that occur when computing with ITensor

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

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?

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 or TiledArray 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?

1 Like