Sign inSign up

therealcaoyudong/qtorch_test

By therealcaoyudong

•Updated about 9 years ago

For testing Liquid, qTORCH and solving MAXCUT using SDP

Image
0

967

therealcaoyudong/qtorch_test repository overview

** MAXCUT solver **

Base image: ubuntu

Additional installations:

sdpa - A package for solving semidefinite programming problems

** Testing qTORCH **

  • Base image: ubuntu

  • Additional installations:

Python 2.7 Jupyter Notebook

and also qTORCH code.

  • Utility packages: git, wget, make, sudo, ...

** Testing Liquid **

Base image: ubuntu

Additional installations:

  • mono, fsharp, git, vim and supporting libraries
  • Liqui|>, which is installed in root/Liquid. In addition, the folder Liquid\qasmsim contains F# script qasm2fsx.fsx for converting a .qasm file to an F# script .fsx file. Running qasm2fsx.fsx generates a new F# script circfunc.fsx, which has the .qasm circuit built into it as a function. Then if we run circfunc.fsx, specifically the function runqasmcirc, calling Liquid, we obtain the cost for the simulation. All of these are packaged in the following scripts, also included in the Liquid\qasmsim folder:
    • run_qasm.sh: runs Liquid on a single qasm file, and return the results in a .csv file
    • run_qasm_dir.sh: runs Liquid iteratively on all files in a given directory, and return the results in a .csv file
    • run_qasm_subdir.sh: runs Liquid iteratively on all files in all subdirectories of a directory, and return the results in a .csv file
    • run_qasm_list.sh: runs Liquid iteratively on all files listed in a list that are also contained in a given directory

Instructions for running the image on any machine:

  • Pull and run the image by

docker run -it therealcaoyudong/liquid_qasm:latest

*If you want to open a new window that also runs the same container in bash, type in the new command prompt

docker ps

to find the name (or ID) of the container in which you are currently running the liquid_qasm image, and type

docker exec -it <container_name> bash

  • Once the container is running, first run Liquid by

mono root/Liquid/bin/Liquid.exe

and you will be prompted to accept the license. Hit Y and Enter. You will be directed back to the shell.

  • Go to root/Liquid/qasmsim

  • Pull the .qasm circuits from the repository using git by

git clone

  • Change the privilege for shell scripts using

chmod +x *.sh

  • Run the main script:

    • Ideally the repo folder should not contain subfolders i.e. all the qasm files are in the root directory of the repository so that once you pulled it you see all the qasm files by just going into the working directory of the local repo copy. If that is the case, run

      ./run_qasm_dir.sh <measurement .txt file>

    • If the repo directory contains one layer of subdirectories each containing qasm files, you need to loop over the subdirectories and run the script on each subdirectory, use

      ./run_qasm_subdir.sh <measurement .txt file>

    • To run individual .qasm file, use

      ./run_qasm.sh <measurement .txt file>

    • To run .qasm file from a list of file names, use

      ./run_qasm_list.sh <measurement .txt file>

      For example to run all 10-qubit circuits, first generate the list by

      ls qcitcoin-tn-files/maxcut-circ-bat-1 | grep 10Node > filelist

      and then run the files by

      ./run_qasm_list.sh qcitcoin-tn-files/maxcut-circ-bat-1 filelist

  • The script will iterate through all the qasm files in the directory, run it with Liquid, time it and tabulate the results in the output file results.csv

  • You can rename and send the csv file to your own remote repo to preserve the results. Otherwise results.csv will be overwritten in the next run.

Tag summary

Content type

Image

Digest

Size

1.4 GB

Last updated

about 9 years ago

docker pull therealcaoyudong/qtorch_test