Comments (6)
Some context on the qsim side: this should only affect the *for.h
, simulator_*.h
, and statespace_*.h
files. TFQ calls the methods provided by simulator
and statespace
, so the new For
object could be passed in from there.
This is in the simulation "hot path", but by passing reference objects I think we can avoid any significant performance impact.
from qsim.
I think this is a good proposal. I'll do this in a slightly different way like this:
template <typename For>
class SimulatorAVX {
...
template <typename... Args>
SimulatorAVX(unsigned num_qubits, Args&&... args)
: for_(args...), num_qubits_(num_qubits) {}
...
For for_;
...
};
Instead of passing a For object to every function, I keep the classes templated and add a (lightweight) For object to them. This requires only minimal changes to statespace*.h and to simulator*.h and basically no changes to the existing client code and tests.
from qsim.
Ok, just to clarify with this new way of doing things can I still do something like this ?
auto my_for = tfq::TFQFor(tfOpKernelContext->get_available_cpu_workers())
auto qsim_simulator = SimulatorAVX<tfq::TFQFor>(num_qubits, ... , my_for); // my_far passed in as a const TFQFor& ?
and expect things to work ?
from qsim.
Yes, it is expected to work if tfq::TFQFor
has a copy constructor (user-defined or implicit). One doesn't have to define my_for
. The following will also work:
qsim_simulator = SimulatorAVX<tfq::TFQFor>(num_qubits, tfOpKernelContext->get_available_cpu_workers());
from qsim.
Ok great.
I’ll do this in a slightly different way ...
When could we expect this to be a part of qsim with a new GitHub release ?
from qsim.
Hopefully, it will be in the repository in less than a week.
from qsim.
Related Issues (20)
- QSimSimulator.simulate_expectation_values for identity operators is wrong when the coefficient is other than one
- simulate_expectation_values() produces incorrect expectation values HOT 2
- `No matching distribution found for qsimcirq==0.15.0` for python 3.11 HOT 2
- Upgrade qsim build rules for TFQ HOT 1
- qsimcirq build wheel fails with legacy-install-failure error
- Dynamically link to CUDA and cuQuantum HOT 2
- qsim 0.16 requires more RAM for a simple Hadamards circuit compared to qsim 0.12 HOT 14
- Update MacOS builds HOT 1
- Avoid statevector copy in `qsim.simulate(qc, initial_state=sv)` HOT 12
- Runtime error when attempting to simulate statevector HOT 3
- `Docker / Test on ubuntu-latest` CI failes due to numpy conflict
- `Bazel / Sanitizer tests (msan)` CI failes due to C++ test failure HOT 7
- simulate_expectation_values: qsimcirq outputs wrong result when the Pauli sum contains an identity Pauli string HOT 3
- kokoro CI failure HOT 1
- Python test failing due to `distutils` deprecation
- Question about multi-GPU support HOT 3
- Update minimum boot disk size in GPU tutorial
- Installation from source using system pybind11 broken (and likely never worked) HOT 1
- Compile problem from source with cuda support
- missing py312 wheels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qsim.