You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
It would be good to add a page somewhere with a list of performance tips for ITensor/tensor network contraction methods.
One example is a performance issue I was just running into, where I was contracting two MPS psi and phi like this:
auto N = 10;
auto sites = SiteSet(N,2);
auto psi = MPS(sites);
auto phi = MPS(sites);
auto O = psi(1)*phi(1);
for( auto n : range1(N) )
O *= psi(n) * phi(n);
and getting really bad performance (for medium to large bond dimensions). The definition of *= in ITensor leads to a different order of operations than I was expecting (performing psi(n)*phi(n) first, then contracting with O). So a better way is to write this as:
for( auto n : range1(N) )
{
O *= psi(n);
O *= phi(n);
}
I was used to the definition of x *= y from Julia, where it is always lowered to x = x * y, so it took longer than it should have for me to catch this. Anyway, just adding a note about this for future reference.
The text was updated successfully, but these errors were encountered:
Agreed, it would be good to have information about this sort of thing on the website.
But I should add that this sort of behavior is not ITensor-specific. Instead, it's the order of operations that C++ itself imposes. Still something good for users to be aware of, especially if it's different in Julia.
Yeah I didn't mean to imply it was ITensor specific. But it is something that could be benign if you were not multiplying with ITensors (i.e. multiplying scalars).
It would be good to add a page somewhere with a list of performance tips for ITensor/tensor network contraction methods.
One example is a performance issue I was just running into, where I was contracting two MPS
psi
andphi
like this:and getting really bad performance (for medium to large bond dimensions). The definition of
*=
in ITensor leads to a different order of operations than I was expecting (performingpsi(n)*phi(n)
first, then contracting withO
). So a better way is to write this as:I was used to the definition of
x *= y
from Julia, where it is always lowered tox = x * y
, so it took longer than it should have for me to catch this. Anyway, just adding a note about this for future reference.The text was updated successfully, but these errors were encountered: