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

Error when running "remoteOptimizeCz" function #1

Open
dongmoon-min opened this issue Aug 15, 2022 · 4 comments
Open

Error when running "remoteOptimizeCz" function #1

dongmoon-min opened this issue Aug 15, 2022 · 4 comments

Comments

@dongmoon-min
Copy link

dongmoon-min commented Aug 15, 2022

Hi, I'm dongmoon Min, a researcher at SNU, South Korea.
Thanks for your efforts in developing Quanlse! It is really helpful for our research. :)

I confront an error when I run "remoteOptimizeCz".
As I want to get the infidelity with a smaller dt, I followed the tutorial for CZ gate (https://quanlse.baidu.com/#/doc/tutorial-cz) but just changed dt from 1.0 to 0.1.

How can I reduce dt without error in "remoteOptimizeCz"?
Is this the expected error for developers too?

I attach my codes and error messages as below.

#codes.
`
from Quanlse.QHamiltonian import QHamiltonian as QHam
from Quanlse.QOperator import duff, number
from Quanlse.remoteOptimizer import remoteOptimizeCz
from Quanlse.Utils.Functions import project
import Quanlse
from numpy import round
from math import pi

dt = 0.1
qubits = 2
level = 3

ham = QHam(subSysNum=qubits, sysLevel=level, dt=dt)
qubitArgs = {
"coupling": 0.0277 * (2 * pi), # Coupling of Q0 and Q1
"qubit_freq0": 5.805 * (2 * pi), # Frequency of Q0
"qubit_freq1": 5.205 * (2 * pi), # Frequency of Q1
"drive_freq0": 5.205 * (2 * pi), # Drive frequency on Q0 (rotating frame)
"drive_freq1": 5.205 * (2 * pi), # Drive frequency on Q1 (rotating frame)
"qubit_anharm0": -0.217 * (2 * pi), # Anharmonicity of Q0
"qubit_anharm1": -0.226 * (2 * pi) # Anharmonicity of Q1
}

for qu in range(2):
ham.addDrift(number, qu, (qubitArgs[f"qubit_freq{qu}"] - qubitArgs[f"drive_freq{qu}"]))
ham.addDrift(duff, qu, qubitArgs[f"qubit_anharm{qu}"] / 2)

ham.addCoupling([0, 1], qubitArgs["coupling"] / 2)
from Quanlse import Define
Define.hubToken = '?????' # I filled the token correctly.
aBound=(-5, 0) # The bound of the pulse's strength
gateJob, infidelity = remoteOptimizeCz(ham, aBound=aBound, tg=400, maxIter=60, targetInfidelity=0.001)
`

#Error.
`
Traceback (most recent call last):
File "", line 1, in
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/remoteOptimizer.py", line 147, in remoteOptimizeCz
origin = rpcCall("CZ", args, kwargs)
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QRpc.py", line 103, in rpcCall
taskResult = _waitTask(token, taskId, downloadResult=True)
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 72, in _func
return func(*args, **kwargs)
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 238, in _waitTask
raise err
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 208, in _waitTask
ret = invokeBackend("task/checkTask", task)
File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 58, in invokeBackend
raise Error.LogicError(errMsg)
Quanlse.QPlatform.Error.LogicError: Current system is Linux, use CPP ODESolver!

Starting global optimization (no.1 iteration) ...
A local minimal found...infidelity: 0.4211929723567549
A local minimal found...infidelity: 0.1948303506292144
A local minimal found...infidelity: 0.0021642031174996523
Current system is Linux, use CPP ODESolver!

Starting global optimization (no.1 iteration) ...
A local minimal found...infidelity: 0.4211929723567549
A local minimal found...infidelity: 0.1948303506292144
A local minimal found...infidelity: 0.0021642031174996523
undefined
`

@smartmzl
Copy link

Hi, I'm dongmoon Min, a researcher at SNU, South Korea. Thanks for your efforts in developing Quanlse! It is really helpful for our research. :)

I confront an error when I run "remoteOptimizeCz". As I want to get the infidelity with a smaller dt, I followed the tutorial for CZ gate (https://quanlse.baidu.com/#/doc/tutorial-cz) but just changed dt from 1.0 to 0.1.

How can I reduce dt without error in "remoteOptimizeCz"? Is this the expected error for developers too?

I attach my codes and error messages as below.

#codes. ` from Quanlse.QHamiltonian import QHamiltonian as QHam from Quanlse.QOperator import duff, number from Quanlse.remoteOptimizer import remoteOptimizeCz from Quanlse.Utils.Functions import project import Quanlse from numpy import round from math import pi

dt = 0.1 qubits = 2 level = 3

ham = QHam(subSysNum=qubits, sysLevel=level, dt=dt) qubitArgs = { "coupling": 0.0277 * (2 * pi), # Coupling of Q0 and Q1 "qubit_freq0": 5.805 * (2 * pi), # Frequency of Q0 "qubit_freq1": 5.205 * (2 * pi), # Frequency of Q1 "drive_freq0": 5.205 * (2 * pi), # Drive frequency on Q0 (rotating frame) "drive_freq1": 5.205 * (2 * pi), # Drive frequency on Q1 (rotating frame) "qubit_anharm0": -0.217 * (2 * pi), # Anharmonicity of Q0 "qubit_anharm1": -0.226 * (2 * pi) # Anharmonicity of Q1 }

for qu in range(2): ham.addDrift(number, qu, (qubitArgs[f"qubit_freq{qu}"] - qubitArgs[f"drive_freq{qu}"])) ham.addDrift(duff, qu, qubitArgs[f"qubit_anharm{qu}"] / 2)

ham.addCoupling([0, 1], qubitArgs["coupling"] / 2) from Quanlse import Define Define.hubToken = '?????' # I filled the token correctly. aBound=(-5, 0) # The bound of the pulse's strength gateJob, infidelity = remoteOptimizeCz(ham, aBound=aBound, tg=400, maxIter=60, targetInfidelity=0.001) `

#Error. ` Traceback (most recent call last): File "", line 1, in File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/remoteOptimizer.py", line 147, in remoteOptimizeCz origin = rpcCall("CZ", args, kwargs) File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QRpc.py", line 103, in rpcCall taskResult = _waitTask(token, taskId, downloadResult=True) File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 72, in _func return func(*args, **kwargs) File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 238, in _waitTask raise err File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 208, in _waitTask ret = invokeBackend("task/checkTask", task) File "/home/student/ehdans06/anaconda3/envs/qiskit/lib/python3.10/site-packages/Quanlse/QTask.py", line 58, in invokeBackend raise Error.LogicError(errMsg) Quanlse.QPlatform.Error.LogicError: Current system is Linux, use CPP ODESolver!

Starting global optimization (no.1 iteration) ... A local minimal found...infidelity: 0.4211929723567549 A local minimal found...infidelity: 0.1948303506292144 A local minimal found...infidelity: 0.0021642031174996523 Current system is Linux, use CPP ODESolver!

Starting global optimization (no.1 iteration) ... A local minimal found...infidelity: 0.4211929723567549 A local minimal found...infidelity: 0.1948303506292144 A local minimal found...infidelity: 0.0021642031174996523 undefined `

Hi, dongmoon Min,
Thank you for your feedback!
This error may not be caused by reducing dt. I noticed that you are using Python 3.10 as the environment, however, Quanlse supports Python 3.7~3.8 with better performance.

@dongmoon-min
Copy link
Author

dongmoon-min commented Aug 20, 2022

Thanks, I checked it with Python 3.8 and it runs!

I have one more question.
May I ask the unit of the pulse amplitude for CZ gates?
I want to get the absolute value of the amplitude but it is just reported as an "arbitrary unit (a.u.)".

@smartmzl
Copy link

Thanks, I checked it with Python 3.8 and it runs!

I have one more question. May I ask the unit of the pulse amplitude for CZ gates? I want to get the absolute value of the amplitude but it is just reported as an "arbitrary unit (a.u.)".

As you said, the pulse amplitude is in arbitrary unit.

@dongmoon-min
Copy link
Author

dongmoon-min commented Aug 23, 2022

In fact, what I want to ask was the absolute unit of the pulse amplitude, because "the arbitrary unit" is the relative unit which is normalized to "something" that the authors arbitrarily define (and my question was what is "something" exactly).

I think the absolute unit seems confidential in your company.
Anyway, thanks for your answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants