rht

Results 789 comments of rht

How did you use `orjson` to replace the `json.Encoder` usage in `CirqEncoder`? In this case (non-primitive data types), is `orjson` faster because it has a faster dataclass encoding?

I suppose point 1 and 2 make sense if the serialized JSON needs to be human readable. But there is already the ASCII string representation of the circuit, which is...

The JSON serialization is the only method that has been documented in https://quantumai.google/cirq/build/interop. The page additionally describes importing from QASM 2, but not exporting to it (and AFAIK exporting to...

Solving this piecewise: - allocation 4 could be removed if `cirq.StateVectorSimulationState` has an extra argument `inplace=True` for the [simulation output](https://github.com/quantumlib/qsim/blob/72a96d5780f7d239a57a750d2d3aab0375cec95d/qsimcirq/qsim_simulator.py#L530), which prevents the copy operation if enabled. - allocation 3...

On 30 qubits, for [this circuit](https://github.com/quantumlib/qsim/issues/612#issue-1716537877), removing the copy operation reduces the elapsed: ```python from memory_profiler import memory_usage import time import cirq import qsimcirq def f(): num_qubits = 30 qc_cirq...

The benchmark on cuQuantum Appliance 22.11 (Cirq 0.14.1, qsimcirq 0.12.1), before the large memory usage was introduced: ``` Max memory 8943.50390625, elapsed 7.8 s ```

Point no. 3 in the original post is not an allocation. It's just a view, but already has been removed by @NoureldinYosri in https://github.com/quantumlib/qsim/commit/0009bc4f47d954c3eadd883aa458d78af7fa040e.

Yeah, I'm aware of `simulate_into_1d_array` for my use case. The separate question is whether it is a long-term general solution, once NumPy removes its 32 dimensions limitation.

It could also be due to older versions of Cirq for the qsimcirq 0.13 that I tested. I did it on an older version of cuQuantum Appliance, which has an...

I tried qsimcirq 0.16.3 + Cirq 0.14, still OOM-ed. As such, the code that causes the increased memory cost is very likely in the qsim repo.