GithubHelp home page GithubHelp logo

lanl / qmasm Goto Github PK

View Code? Open in Web Editor NEW
337.0 42.0 73.0 738 KB

Quantum macro assembler for D-Wave systems

License: Other

Python 99.64% Emacs Lisp 0.36%
quantum-computing quantum-programming-language quantum-information

qmasm's Introduction

QMASM: A Quantum Macro Assembler

Build Status PyPI version

Description

QMASM fills a gap in the software ecosystem for D-Wave's adiabatic quantum computers by shielding the programmer from having to know system-specific hardware details while still enabling programs to be expressed at a fairly low level of abstraction. It is therefore analogous to a conventional macro assembler and can be used in much the same way: as a target either for programmers who want a great deal of control over the hardware or for compilers that implement higher-level languages.

N.B. This tool used to be called "QASM" but was renamed to avoid confusion with MIT's QASM, which is used to describe quantum circuits (a different model of quantum computation from what the D-Wave uses) and the IBM Quantum Experience's QASM (now OpenQASM) language, also used for describing quantum circuits.

Installation

QMASM is written in Python. The latest release can be downloaded and installed from PyPI via

pip install qmasm

Alternatively, QMASM can be installed manually from GitHub using the standard Setuptools installation mechanisms. For example, use

python setup.py install

to install QMASM in the default location and

python setup.py install --prefix=/my/install/directory

to install elsewhere.

Documentation

Documentation for QMASM can be found on the QMASM wiki.

QMASM (then known as QASM) is discussed in the following publication:

Scott Pakin. "A Quantum Macro Assembler". In Proceedings of the 20th Annual IEEE High Performance Extreme Computing Conference (HPEC 2016), Waltham, Massachusetts, USA, 13โ€“15 September 2016. DOI: 10.1109/HPEC.2016.7761637.

License

QMASM is provided under a BSD-ish license with a "modifications must be indicated" clause. See the LICENSE file for the full text.

This package is part of the Hybrid Quantum-Classical Computing suite, known internally as LA-CC-16-032.

Author

Scott Pakin, [email protected]

qmasm's People

Contributors

lsaldyt avatar rizkg avatar spakin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qmasm's Issues

Recorded plist has different files than the ones installed

The FreeBSD package builder uses the --record {plist-file} command to record the plist. The recorded plist differs from the actually installed files:

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: bin/qb2qmasm
Error: Orphaned: bin/qmasm
Error: Orphaned: bin/qmasm-ground-state
Error: Orphaned: bin/qmasm-qbsolv
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: bin/qb2qmasm.py
Error: Missing: bin/qmasm-ground-state.py
Error: Missing: bin/qmasm-qbsolv.py
Error: Missing: bin/qmasm.py
===> Error: Plist issues found.

Using qmasm with FakeConnection

I see that with a fake connection I can only have the solver named 'phony'. If I set the dwave solver to c4-sw_sample, the code fails.
And using the default 'phony' solver, I end up outputting "Without D-Wave's libraries, QMASM can do little more than output qbsolv, MiniZinc, and flattened QMASM files" without any solutions. Could you please help me understand this?

boolean-vs-Ising variables

I'm a bit confused with the support of "boolean-vs-Ising variables", together with the -q and --values=bool options:

  • Does the -q flag mean that the input QMASM file defines a boolean (0/1) optimization problem (instead of a spin (-1/+1) problem), as is possible e.g. with the BQPJSON tool, or does it indicate that the input has a different syntax (maybe the QUBO syntax of qbsolve)? I get an error when running a *.qmasm file (with qbsolv) with that flag.

  • does the --values have any effect when we use qmasm without a DWave (such as in qbsolv mode)? I don't see any difference (but I'm no so sure what I'm doing is correct).

Thanks in advance.
[don't hesitate to tell if such questions should preferably be asked by email]

empty output, no errors

When I try to submit a very big qmasm file (here 17'350 variables and 87'689 couplers) in qbsolv format, I expect QMASM either to produce a solution or to fail with an error (for example a timeout or a memory error). None of that happens, instead I get an empty output after about 4s:

time qmasm --format=qbsolv -q --run big_file.qmasm

real	0m32.333s
user	0m23.580s
sys	0m4.260s

I also tried passing a timeout parameter to qbsolv (--extra-args "-t 10") or specifying I want all the solutions (--show all), but the result is the same.

Is this the intended behavior ? How should I interpret an empty output ?

Python version

Hi,
first of all, thank you for this awesome tool !

I lost a bit of time during the installation because I didn't figure it was using Python 2. Using python 3, it just returns a bunch of strange errors that are not that revealing. I would suggest to add it somewhere in the README or to change the shebang to #!/usr/bin/env python3, so others won't fall into the same trap :).

examples in qbsolv mode

What is the expected outcome when running the examples (eg examples/1of5.qmasm) in qbsolv mode (classical solver, no DWave)? Could you add a couple of lines in the doc/readme about that (command line + output)?

I've tried something, but it seems it ends with an error (see below).

Disclaimer: it's my very first steps, and clumsiness on my side is highly probable (shame on me)...

BTW, I think it's a great project/tool; thanks a lot for sharing this contribution!

    /usr/local/bin/qmasm 1of5.qmasm --format qbsolv --run -v

Computed the following strengths:

    chain: -8.0000
    pin:   -8.0000

Encountered the following solver properties:

    Parameter    Value
    -----------  -----
    solver_name  'phony'

Submitting the problem to qbsolv via qmasm-qbsolv.

# 8 bits,  find Min, SubMatrix= 47, -a o, timeout=2592000.0 sec
# 00010000
# -4.00000 Energy of solution
# 0 Number of Partitioned calls, 1 output sample
#  0.00093 seconds of classic cpu time

Solution #1 (energy = -4.00, tally = 1):

    Name(s)  Spin  Boolean
    -------  ----  -------
Traceback (most recent call last):
  File "/usr/local/bin/qmasm-qbsolv", line 87, in <module>
    spin = bits[num]*2 - 1
IndexError: list index out of range

installation

Hi,
I installed qasm but it does not work, it seems the dwave_sapi2 python module is required. Is it available somewhere ? Is it part of the qOp package from d-wave ? (I have qOp installed already)
Thanks,
Guillaume

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.