Munich-Quantum-Software-Stack / QDMI

Quantum Device Management Interface (QDMI)
https://munich-quantum-software-stack.github.io/QDMI/
Apache License 2.0
27 stars 0 forks source link

Multiple QDMI_Session can't remain simultaneously active #43

Closed Durganshu closed 1 month ago

Durganshu commented 4 months ago

While testing the integration of sys-sage and FoMaC, we observed that if one QDMI_Session is already active, opening another QDMI_Session won't work. This issue can be further investigated.

burgholzer commented 4 months ago

Thanks for raising this issue. Could you be a little more specific on the "doesn't work" part? Explicitly: what kind of errors are you getting or what is the precise problem?

Durganshu commented 4 months ago

I'll summarize what we found:

In FoMactest, we created a QDMI_Session and invoked FOMAC_available_devices();

QInfo info;
QDMI_Session session = NULL;
 int err = QInfo_create(&info);
 err = QDMI_session_init(info, &session);
 auto availableDevices = FOMAC_available_devices(&session);

Inside FOMAC_available_devices(), I create an object of QdmiParser, that automatically initiates another session internally and tries to fetch the backend properties:

QdmiParser qdmi;
const auto quantum_backends = qdmi.get_available_backends(); // Returns a list of all the backends 
std::cout << "   [FoMaC].............Total "<< quantum_backends.size() << " devices found.\n";

The output of this message should be: "Total 1 devices found". Instead, we got"0" here.

When we tried to debug this, we found that QdmiParser::session, which is a static object within QdmiParser, wasn't getting initiated, and thus, we were not getting any reasonable output.

It is important to note that we were just initiating a session in FoMacTest and not using it. The moment we commented that out, we started getting reasonable results.

We think this could be the reason behind the anomaly that was noticed earlier.

burgholzer commented 4 months ago

Thanks for the details! Those really help.

Just a thought: should the QDMI Parser constructor maybe take a session object as one of its arguments? Particular sessions could have access to different devices.

Independent of that: let's keep this issue open for now and investigate whether something is off in the QDMI implementation.