Closed amarjahin closed 3 years ago
Does this segfault still occur if you use the main branch?
A quick tangential question. I have a problem using qiskit-aer 0.9.0 (what I get by switching to main branch) and qiskit 0.29.1 which requires qiskit-aer 0.8.2. For example when I try import qiskit.providers.aer
:
File "/home/ammar/Documents/qcode/fermilab_intern/test_sigfault/venv/lib/python3.9/site-packages/qiskit/providers/aer/__init__.py", line 73, in <module>
from .aerprovider import AerProvider
File "/home/ammar/Documents/qcode/fermilab_intern/test_sigfault/venv/lib/python3.9/site-packages/qiskit/providers/aer/aerprovider.py", line 19, in <module>
from .backends.aer_simulator import AerSimulator
File "/home/ammar/Documents/qcode/fermilab_intern/test_sigfault/venv/lib/python3.9/site-packages/qiskit/providers/aer/backends/__init__.py", line 17, in <module>
from .aer_simulator import AerSimulator
File "/home/ammar/Documents/qcode/fermilab_intern/test_sigfault/venv/lib/python3.9/site-packages/qiskit/providers/aer/backends/aer_simulator.py", line 27, in <module>
from .controller_wrappers import aer_controller_execute
ImportError: /home/ammar/Documents/qcode/fermilab_intern/test_sigfault/venv/lib/python3.9/site-packages/qiskit/providers/aer/backends/controller_wrappers.cpython-39-x86_64-linux-gnu.so: undefined symbol: slamch_
I have tested your code.
In my environment, Aer 0.8.2 can finish your code without error.
$ pip list | grep qiskit
qiskit 0.29.0
qiskit-aer 0.8.2
qiskit-aqua 0.9.4
qiskit-ibmq-provider 0.16.0
qiskit-ignis 0.6.0
qiskit-machine-learning 0.2.0
qiskit-nature 0.2.0
qiskit-sphinx-theme 1.8.5
qiskit-terra 0.18.1
main can also finish your code without error, too.
Interesting. I tried matching your versions exactly,
$ pip list | grep qiskit
qiskit 0.29.0
qiskit-aer 0.8.2
qiskit-aqua 0.9.4
qiskit-ibmq-provider 0.16.0
qiskit-ignis 0.6.0
qiskit-terra 0.18.1
and I still can't get it to run. Actually now I get a much shorter message of just Segmentation fault (core dumped)
.
Could this then be a problem with howa Aer interact with the OS? Can I ask what OS you use?
Also I think I was wrong about which line produces the segfault. Even if I commented result = result.result()
in the above code I get the same error.
Another thing that is interesting is that if I comment line 57:
qc.append(change_ansatz(m, init_gauge_p=[7, 13, 14, 11]).to_instruction(), qargs=[*range(m)])
I don't get the error.
I had the chance to test this on a windows laptop, and it works fine on it as well. I still have the problem on Manjaro Linux. I'm not sure, is this Manjaro's problem? Should I close this issue?
Okay, I got the above code to run on my machine by adding a qc.barrier()
in the function change_ansatz
. It now looks like this:
def change_ansatz(m, init_gauge_p):
qc = QuantumCircuit(m, name='change_ansatz')
if len(init_gauge_p) != 0:
qc.x(init_gauge_p)
for q in init_gauge_p:
for i in range(0, q):
qc.z(i)
qc.barrier()
return qc
Since this works, I'm happy to close the issue, though this definitely seems a little weird, since barriers aren't supposed to change anything, do they?
Barriers should only be for terra transpiler since they are ignored by Aer. The transpilation can affect simulation execution though.
The segfault (undefined symbol: slamch_
) looks to be something related to LAPACK. I'm not sure why commenting out that line or adding a barrier would affect it though.
Informations
Qiskit Aer version: qiskit 0.26.0 qiskit-aer 0.8.2 qiskit-aqua 0.9.1 qiskit-ibmq-provider 0.13.1 qiskit-ignis 0.6.0 qiskit-nature 0.1.2 qiskit-optimization 0.1.0 qiskit-terra 0.17.3
Python version: Python 3.9.6
Operating system: Manjaro 21.1.2 Pahvo
What is the current behavior?
Segmentation fault (core dumped).
Steps to reproduce the problem
Here's a MWE (at least as minimal as I can get the bug to occur)
Here's what I get running this:
What is the expected behavior?
I'm not sure if this is qiskit's fault or linux's fault, or my fault. It's also that the error message is not clear (at least to me, someone who isn't a software engineer).
Suggested solutions
I honestly don't know. But as the error message suggest something needs to be wrapped with sig_on(), sig_off?