Skip to content
New issue

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

Segmentation Fault #42

Closed
chMoussa opened this issue Jul 31, 2018 · 10 comments
Closed

Segmentation Fault #42

chMoussa opened this issue Jul 31, 2018 · 10 comments
Assignees
Labels

Comments

@chMoussa
Copy link

Hello,

I have a segmentation fault from getMeasurementStrings and getMeasurementCounts.
I installed XACC and plugings with pip on Docker images.
I am attaching the printing of a simple script and the script.

segfault

import pyxacc as xacc
import sys

def hello(acc="ibm",backendinput="ibmq_qasm_simulator"):
xacc.Initialize(["--compiler","quil"])
accelerator = acc
backend = backendinput

qpu = xacc.getAccelerator(accelerator)
nqbits = 2

xacc.setOption(acc+"-backend",backend)
# code commented is for setting
# the number of trials one run the circuit (default 1024)
# One can set any option that come with the accelerator
# xacc.setOption("ibm-shots","1024")
# xacc.setOption("rigetti-trial","1024")

qreg = qpu.createBuffer("qreg",nqbits)

src = """__qpu__ bell(AcceleratorBuffer b){
H 0
CNOT 0 1
MEASURE 0 [0]
MEASURE 1 [1]
}
"""

program = xacc.Program(qpu,src)
program.build()

k = program.getKernel("bell")
k.execute(qreg,[])

print(qreg.getMeasurementStrings())
print(qreg.getMeasurementCounts())
xacc.Finalize()

if name == "main":

if len(sys.argv) == 3:
    hello(sys.argv[1],sys.argv[2])
else:
    hello()
@amccaskey
Copy link
Contributor

@chMoussa Thanks for filing this issue. We're going to look into it today and see what we find. It may be that the Pip wheels need to be updated.

@amccaskey amccaskey added the bug label Jul 31, 2018
@amccaskey amccaskey self-assigned this Jul 31, 2018
@czhao39
Copy link
Contributor

czhao39 commented Jul 31, 2018

@chMoussa Your code ran successfully for me. I built XACC and the plugins from source, though, so I will try using pip and get back to you in a bit.

@czhao39
Copy link
Contributor

czhao39 commented Jul 31, 2018

@chMoussa The xacc-ibm code currently on PyPI is outdated. We tried pip installing the latest version of the xacc-ibm plugin and your program worked, so we'll release the updated version to PyPI soon. Once we do that, you can run pip install -U xacc-ibm to upgrade.

@amccaskey
Copy link
Contributor

@chMoussa I have uploaded an updated xacc-ibm wheel to PyPi. You can now run

$ python -m pip install --upgrade xacc-ibm

Let us know if that gets rid of your bug.

Note you should see it upgrade to version 0.1.1

@chMoussa
Copy link
Author

What is the new name?

xaccibmname

@amccaskey
Copy link
Contributor

Hey Charles,

Notice that you don't have the IBM plugin installed (does not say 'Installed plugin 'xacc-ibm-'). Also notice that your XACC install is in your ~/.local/ directory, so you installed the XACC wheel with --user. If you run pip install xacc --user, then you must run all plugin installs with --user.

I suggest

$ python -m pip uninstall xacc-ibm (which should remove it from wherever it was installed)
$ python -m pip install xacc-ibm --user --no-cache

You should see that it downloads and install version 0.1.1.

@chMoussa
Copy link
Author

I run the pip upgrade and it told me it was upgraded to 0.1.1.
But anyway I run your last commands and I finally got rid of the segmentation fault.

@chMoussa
Copy link
Author

Can we do the same for rigetti ?

hellorigetti

@amccaskey
Copy link
Contributor

Hey @chMoussa I have updated the rigetti wheels as well. Go ahead and try to uninstall what you have and then run

$ python -m pip install xacc-rigetti --no-cache --user

Only pass --user if that is what you passed for XACC.

Note the version that you should see for rigetti is 0.1.3

@chMoussa
Copy link
Author

chMoussa commented Aug 1, 2018

Working well now thanks

@chMoussa chMoussa closed this as completed Aug 1, 2018
wongey pushed a commit to wongey/xacc that referenced this issue Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants