Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ find_package(qdmi REQUIRED)
# Find QInfo package
find_package(qinfo REQUIRED)

# Find sys-sage package
find_package(sys-sage REQUIRED)

# Find the Threads package
find_package(Threads REQUIRED)

Expand Down Expand Up @@ -141,6 +144,7 @@ foreach(src_file ${ANALYSIS_PASSES_SOURCE_FILES})
qdmi
qinfo
#fomac
sys-sage
utilities)

target_include_directories(${target_name}
Expand Down Expand Up @@ -169,6 +173,7 @@ foreach(src_file ${TRANSFORMATION_PASSES_SOURCE_FILES})
qdmi
qinfo
#fomac
sys-sage
utilities
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/Findqdmi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
qdmi
GIT_REPOSITORY git@github.com:Munich-Quantum-Software-Stack/QDMI.git
GIT_TAG develop
GIT_TAG ibm-backend-testing
)

FetchContent_MakeAvailable(qdmi)
Expand Down
9 changes: 9 additions & 0 deletions cmake/Findsys-sage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(FetchContent)

FetchContent_Declare(
sys-sage
GIT_REPOSITORY git@github.com:Durganshu/sys-sage.git
GIT_TAG qc-integration
)

FetchContent_MakeAvailable(sys-sage)
35 changes: 9 additions & 26 deletions src/ArchitectureFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
#include "ArchitectureFactory.hpp"

#include <sys-sage.hpp>
#include <cstdint>
#include <set>
#include <utility>

namespace mqt {

Architecture createArchitecture(QDMI_Device dev) {
int num_qubits = 0;

int err = QDMI_query_qubits_num(dev, &num_qubits);
if (err != QDMI_SUCCESS)
throw std::runtime_error("Could not get number of qubits via QDMI");
if (num_qubits == 0)
throw std::runtime_error("Number of qubits cannot be zero");

QDMI_Qubit qubits;

// create a coupling map
err = QDMI_query_all_qubits(dev, &qubits);

// QdmiParser: sys-sage's interface to qdmi (for retrieving the static topology)
QdmiParser qdmi;

if (err != QDMI_SUCCESS || qubits == NULL)
throw std::runtime_error("Could not get qubits via QDMI");
// An instance to QuantumBackend for storing the topology
QuantumBackend qc = createQcTopo(dev);

CouplingMap cm{};
for (int i = 0; i < num_qubits; i++)
{
if (qubits[i].coupling_mapping != NULL && qubits[i].size_coupling_mapping)
{
for (int j = 0; j < qubits[i].size_coupling_mapping; j++)
cm.emplace(i, qubits[i].coupling_mapping[j]);
}
}
std::uint16_t num_qubits = qc.GetNumberofQubits();

free(qubits);
CouplingMap cm = qc.GetAllCouplingMaps();

return {static_cast<std::uint16_t>(num_qubits), cm};
return {num_qubits, cm};
}
} // namespace mqt