jcmgray / cotengra

Hyper optimized contraction trees for large tensor networks and einsums
https://cotengra.readthedocs.io
Apache License 2.0
174 stars 32 forks source link

optimize='hyper-spinglass' #2

Closed panzhang83 closed 4 years ago

panzhang83 commented 4 years ago

In the following code: eq, shapes = oe.helpers.rand_equation(100, 3,d_min=2,d_max=2,seed=1) path, info = oe.contract_path(eq, *shapes, shapes=True, optimize='hyper-spinglass') I encountered "KeyError: "Path optimizer 'auto-hq' not found, valid options are {'random-greedy', 'quickbb-2', 'flowcutter-60', 'branch-all', 'hyper-greedy', 'hyper-256', 'quickbb-10', 'flowcutter-10', 'hyper-betweenness', 'flowcutter-2', 'eager', 'greedy', 'auto', 'branch-1', 'dynamic-programming', 'quickbb-60', 'hyper', 'hyper-kahypar', 'branch-2', 'hyper-spinglass', 'dp', 'opportunistic', 'optimal'}.""

It seems that somehow in the core.py: ContractionTree.contract(), the optimize is still the default value 'auto-hq', instead of spinglass.

jcmgray commented 4 years ago

You will need to install a develop version of opt_einsum. 'auto-hq' is the optimizer used to combine partitions when there are more than 2.


From: Pan Zhang notifications@github.com Sent: Friday, February 14, 2020 3:42:53 AM To: jcmgray/cotengra cotengra@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [jcmgray/cotengra] optimize='hyper-spinglass' (#2)

In the following code: eq, shapes = oe.helpers.rand_equation(100, 3,d_min=2,d_max=2,seed=1) path, info = oe.contract_path(eq, *shapes, shapes=True, optimize='hyper-spinglass') I encountered "KeyError: "Path optimizer 'auto-hq' not found, valid options are {'random-greedy', 'quickbb-2', 'flowcutter-60', 'branch-all', 'hyper-greedy', 'hyper-256', 'quickbb-10', 'flowcutter-10', 'hyper-betweenness', 'flowcutter-2', 'eager', 'greedy', 'auto', 'branch-1', 'dynamic-programming', 'quickbb-60', 'hyper', 'hyper-kahypar', 'branch-2', 'hyper-spinglass', 'dp', 'opportunistic', 'optimal'}.""

It seems that somehow in the core.py: ContractionTree.contract(), the optimize is still the default value 'auto-hq', instead of spinglass.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jcmgray/cotengra/issues/2?email_source=notifications&email_token=ACERARRHZMFE24WHEH4FJHDRCZ7T3A5CNFSM4KVGNUY2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4INROAFQ, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACERARSOOJPV5YBG654ATFDRCZ7T3ANCNFSM4KVGNUYQ.

jcmgray commented 4 years ago

Let me know if that gets it working!

panzhang83 commented 4 years ago

I have installed opt_einsum 3.1.0, can you explain in detail how to install the develop version?

By the way, code path, info = oe.contract_path(eq, *shapes, shapes=True, optimize='hyper-kahypar') also outputs "KeyError: "Path optimizer 'auto-hq' not found,...", together with many lines of "No filename for partition file specified"

jcmgray commented 4 years ago

Hi sorry by 'develop' version I meant the latest (currently unreleased) version on github. You can either clone it to you computer and install it locally:

$ git clone https://github.com/dgasmith/opt_einsum.git
$ pip install -U -e opt_einsum/

The -U means update and the -e means editable - you can make changes and pull commits and when you reimport opt_einsum the changes will immediately come into effect.

Or you install directly from the github repo:

$ pip install -U git+https://github.com/dgasmith/opt_einsum.git

(in which case the version of opt_einsum will be frozen at the latest commit.)

panzhang83 commented 4 years ago

Yes, installing the develop version of opt_einsum solved my problem. Thanks!