Commit 2577a732 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Add an instruction to run with noise



Fixed code gen to bypass pass manager (not just submit) in FTQC mode.

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent f1a5e048
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
#include <qalloc>
// Compile with: qcor -qpu qpp -qrt ftqc simple-demo.cpp
// or with noise: qcor -qpu aer[noise-model:noise_model.json] -qrt ftqc simple-demo.cpp
// Execute: ./a.out
// We should get the print out conditioned by the measurement.
// If not using the "ftqc" QRT, this will cause errors since the Measure results
+5 −1
Original line number Diff line number Diff line
@@ -213,13 +213,17 @@ void QCORSyntaxHandler::GetReplacement(
    OS << ", " << program_parameters[i];
  }
  OS << ");\n";
  // If this is a FTQC kernel, skip runtime optimization passes and submit.
  OS << "if (runtime_env == QrtType::FTQC) {\n";
  OS << "return;\n";
  OS << "}\n";

  OS << "xacc::internal_compiler::execute_pass_manager();\n";
  OS << "if (optimize_only) {\n";
  OS << "return;\n";
  OS << "}\n";

  OS << "if (is_callable && (runtime_env == QrtType::NISQ)) {\n";
  OS << "if (is_callable) {\n";
  if (bufferNames.size() > 1) {
    OS << "xacc::AcceleratorBuffer * buffers[" << bufferNames.size() << "] = {";
    OS << bufferNames[0] << ".results()";