Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Performance] cuTN circuit2einsum slower than opt_einsum #90

Open
mtjrider opened this issue Sep 26, 2023 Discussed in #53 · 5 comments
Open

[Performance] cuTN circuit2einsum slower than opt_einsum #90

mtjrider opened this issue Sep 26, 2023 Discussed in #53 · 5 comments
Assignees
Labels
bug Something isn't working invalid This doesn't seem right triage needs triage

Comments

@mtjrider
Copy link
Collaborator

mtjrider commented Sep 26, 2023

Discussed in #53

Originally posted by rht May 12, 2023
I was benchmarking cuTensorNet and opt_einsum on the QFT and QAOA circuit, and I found the former to be consistently slower than the latter.
I used the same code in #23 for cuTensorNet, and for opt_einsum:

bitstring = "0" * len(qubits)
# https://optimized-einsum.readthedocs.io/en/stable/autosummary/opt_einsum.contract_path.html#opt_einsum.contract_path
expression, operands = myconverter.amplitude(bitstring=bitstring)
tic = time.time()
path, path_info = oe.contract_path(expression, *operands)
elapsed1 = time.time() - tic
print("Elapsed opt_einsum path finding", elapsed1)
tic = time.time()
output = oe.contract(expression, *operands, optimize=path)
elapsed2 = time.time() - tic
print("Elapsed opt_einsum contract", elapsed2)

Plot for QFT:
benchmark

I think it has something to do with cuTensorNet's path finding being closer to the global optimum. Is there a way to tweak the hyperoptimizer to either stop early, or to have a larger error tolerance, so as to minimize the overall time?

@mtjrider mtjrider added bug Something isn't working invalid This doesn't seem right labels Sep 26, 2023
@mtjrider
Copy link
Collaborator Author

Created based on this discussion:
#53

cc @rht

@mtjrider
Copy link
Collaborator Author

mtjrider commented Sep 26, 2023

The benchmarking code is available in this discussion comment:

#53 (reply in thread)

Gist:

https://gist.github.com/rht/b65dc22ff4826170710661a4e5fec29a

@mtjrider mtjrider added the triage needs triage label Sep 27, 2023
@rht
Copy link

rht commented Oct 7, 2023

The benchmark plot needs to be updated to the 23.06 one: #53 (reply in thread).

@mtjrider
Copy link
Collaborator Author

The benchmark plot needs to be updated to the 23.06 one: #53 (reply in thread).

Done. Please confirm.

@rht
Copy link

rht commented Oct 10, 2023

Confirmed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right triage needs triage
Projects
None yet
Development

No branches or pull requests

5 participants