NVIDIA / NVIDIA/cuQuantum

[Performance] cuTN circuit2einsum slower than opt_einsum

Open
#90 5 comments 0 reactions 2 assignees View on GitHub

Nobody has claimed this yet.

bug invalid triage
Dominant language
Jupyter Notebook
Stars
499
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Discussed in https://github.com/NVIDIA/cuQuantum/discussions/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 https://github.com/NVIDIA/cuQuantum/discussions/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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.