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

Added a benchmark driver script



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent c1fa33e6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@ __qpu__ void testKernel(qreg q) {

int main() {

  // Allocate the qubits, just use an upper bound number of qubits.
  auto q = qalloc(30);
  // Allocate just 1 qubit, we don't actually want to run the simulation.
  auto q = qalloc(1);

  // Run the kernel
  testKernel(q);

benchmarks/driver.py

0 → 100644
+29 −0
Original line number Diff line number Diff line
# Run circuit optimization benchmarks
import glob
import os
import sys
import subprocess
import pathlib
qcorExe = str(pathlib.Path.home()) + "/.xacc/bin/qcor"

# Configurations:
# Optimization level to run:
OPT_LEVEL = 1

dirPath = os.path.dirname(os.path.realpath(__file__))
listOfSrcFiles = glob.glob(dirPath + "/resources/*.qasm")
listOfTestCases = []
for srcFile in listOfSrcFiles:
  testCaseName = os.path.splitext(os.path.basename(srcFile))[0] + ".out"
  listOfTestCases.append(testCaseName)
  print("Compile test case: ", testCaseName)

  process = subprocess.Popen([qcorExe, "-DTEST_SOURCE_FILE=\"" + srcFile + "\"", "-o", testCaseName, "-opt", str(OPT_LEVEL), "-print-opt-stats", "circuit_opt_benchmark.cpp"],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
  stdout, stderr = process.communicate()

for testCase in listOfTestCases:
  print("Run Benchmark: ", testCase)
  testExe = dirPath + "/" + testCase
  process = subprocess.run([testExe], stdout=sys.stdout)

benchmarks/resources/hwb12.qasm

deleted100644 → 0
+0 −73506

File deleted.

Preview size limit exceeded, changes collapsed.