We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graph deconstruction will not release occupied memory.
test code:
#include <iostream> #include <vector> #include "quartz/tasograph/tasograph.h" #include "quartz/context/context.h" using namespace quartz; const std::string input_file = "../experiment/nam_circs/adder_8.qasm"; Context ctx({ GateType::h, GateType::cx, GateType::x, GateType::rz, GateType::add, GateType::input_qubit, GateType::input_param }); QASMParser qasm_parser(&ctx); template<class Vec, class VT> void append(Vec& vec, const VT& value) { vec.emplace_back(value); } auto graph_from_qasm_file(const std::string& file) { DAG *dag = nullptr; qasm_parser.load_qasm(file, dag); return std::make_shared<Graph>( Graph(&ctx, dag) ); } int main() { std::vector<std::shared_ptr<Graph>> buffer; std::cout << "Reading graph... " << std::endl; const auto test_graph = Graph::from_qasm_file(&ctx, input_file); // const auto test_graph = graph_from_qasm_file(input_file); std::cout << "test_graph.get_num_qubits() = " << test_graph->gate_count() << std::endl; while (true) { int delta = 0; std::cin >> delta; if (delta >= 0) { std::cout << "Start appending: size(buffer) = " << buffer.size() << " delta = " << delta << std::endl; for (int i = 0; i < delta; i++) { auto tmp_graph = Graph::from_qasm_file(&ctx, input_file); append(buffer, tmp_graph); } std::cout << "Appending finished: size(buffer) = " << buffer.size() << "\n\n"; } else { std::cout << "\nStart popping: size(buffer) = " << buffer.size() << " delta = " << delta << std::endl; for (int i = delta; i < 0; i++) { buffer.pop_back(); } std::cout << "Popping finished: size(buffer) = " << buffer.size() << "\n\n"; } } return 0; }
ps afu | awk 'NR>1 {$5=int($5/1024)"M";}{ print;}' | grep test_mem
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Graph deconstruction will not release occupied memory.
test code:
The text was updated successfully, but these errors were encountered: