You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last line of the above code example is the return value of the qiskit.utils.parallel.should_run_in_parallel() function. Since everything is set for parallel execution, it is expected that the return value gives True but the output if the code is executed yields False.
Any suggestions?
The problem is the second expression os.getenv("QISKIT_IN_PARALLEL", "FALSE") == "FALSE". This expression is False if "QISKIT_IN_PARALLEL" is set to "TRUE". The expression should be replaced with os.getenv("QISKIT_IN_PARALLEL", "FALSE") == "TRUE".
The text was updated successfully, but these errors were encountered:
I don't quite understand how you're calling should_run_in_parallel here - you say that's the return value, but that's just its code. You haven't actually shown how you're calling it.
QISKIT_IN_PARALLEL is not an environment variable users should set. That's an environment variable Qiskit uses to talk to its subprocesses - if that's "TRUE" it means the current Qiskit is in a child process of a parent that is already running in parallel, so it shouldn't attempt to parallelise further and should_run_in_parallel should return False. The os.getenv("QISKIT_IN_PARALLEL", "FALSE") == "FALSE" line you've highlighted is correct. The QISKIT_PARALLEL variable (which your example suggests is what you've set) is user facing, and you do want to set that to some string like TRUE (though it's only read once on import qiskit, so if you set that environment variable after that, it has no effect).
If you could show a complete script that returns False for that call, what all your QISKIT_* environment variables are _when Python is launched, and the output of qiskit.utils.local_hardware_info(), it will help track down your issue.
(Fwiw, should_run_in_parallel is not currently part of the public API as of Qiskit 1.2 or 1.3 - it's not documented. In #12412 we're looking at overhauling these utility functions to make them far more suitable for public consumption, and refactoring their internals to make them behave in more expected ways.)
I see my mistake, I misinterpreted the QISKIT_IN_PARALLEL variable. I thought this flag should be "TRUE" if processes should be run in parallel, while this is set via the QISKIT_PARALLEL variable.
The should_run_in_parallel function is called within the run method of the qiskit.passmanager.BasePassManager class, to decide if the transpilation of the given quantum circuits should run in parallel. By default this is always disabled for local runs on Windows and macOS. My aim is to enable this on my local machine, to test the functionality, that's why I was looking at the should_run_in_parallel function.
Environment
What is happening?
qiskit.utils.parallel.should_run_in_parallel()
function returnsFalse
if all variables are set for parallel execution.How can we reproduce the issue?
What should happen?
The last line of the above code example is the return value of the
qiskit.utils.parallel.should_run_in_parallel()
function. Since everything is set for parallel execution, it is expected that the return value givesTrue
but the output if the code is executed yieldsFalse
.Any suggestions?
The problem is the second expression
os.getenv("QISKIT_IN_PARALLEL", "FALSE") == "FALSE"
. This expression isFalse
if"QISKIT_IN_PARALLEL"
is set to"TRUE"
. The expression should be replaced withos.getenv("QISKIT_IN_PARALLEL", "FALSE") == "TRUE"
.The text was updated successfully, but these errors were encountered: