-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Parallel tools and compiling #701
Conversation
@diego-plan9, @atilag, and @ajavadia you probably have thoughts on this PR. Please let me know. @chunfuchen Does this look like what you aimed to do in #679? Don't want to step on your toes here. |
- Also try to work around lint and optional imports
@nonhermitian Yes, this way is excellent :), it is what I want to do in #679 . |
Thanks @nonhermitian
So a PR with the first point using some sort of event mechanism (Pub/Sub?) to decouple the progress bar from the compilation could be an option (we can follow up on issue #706) Does it make sense @nonhermitian? |
The refactor is fine by me. I will make a new PR for the parallel parts, and let you handle the progress bar stuff as I am sure you will want to rework that as part of the Pub/Sub framework. This will also allow me to merge #383 with the parallel components, as that PR gives a nice way of returning the number of physical CPU cores, rather than the number of cores + hyperthreads that is returned by the multiprocessing library. Thus we can avoid dispatching too many processes. |
@atilag, This has been updated in the direction that you suggested. In addition, the |
This review is a bit out of date with our current plans.
@mtreinish, @ajavadia please take a look. |
…skit-core into parallel_compile
@nonhermitian can you put all the utils inside the transpiler folder and then we are good to merge this PR. How it talks to other parts of qiskit-terra we will discuss later. |
* Parallel tools and compiling * add blank line * Add parallel compile test - Also try to work around lint and optional imports * disable import-error for optional import * fix indent * Major update wiht magics * fix compile lint * fix style * disable import errors * white space * Add compile with TextProgressBar test * Remove jupyter components * shorten parallel test time * Minimize the parallel routines * cleanup merge * updates * more updates * fix comtypes issue * add comtypes * make comtypes requirement on windows * update changelog * review updates * more updates * remove callback function * fix conflict * Add progressbars back * fix lint errors * better grabbing of progress bars * grab bars in order created * Make jupyter tools availabel by default * fix circular import * switch used order * fix move lint disable * fix signature * fix changelog and releases * revert erroneous changes from git history * revert one more * add back psutil requirement * remove high-level imports * refine changelog * move everything to transpiler folder
Fix #706
Summary
Introduces the ability to run functions in parallel.
The following routines have been added:
parallel_map
.This is supposed to replace #679.
Details and comments
parallel_map
uses the multiprocessing library that is not efficient on Windows, and therefore implements a serial loop on Win platforms. In addition, it checks if the input haslen(value)==1
and just returns the single execution result.The
parallel_map
is smart in the sense that it checks for theQISKIT_IN_PARALLEL
env flag and will not execute in parallel if this flag is'TRUE'
, as set when theparallel_map
is being executed. So you can nest calls toparallel_map
, and only the outer one will execute in parallel. This flag is set to'FALSE'
at init, and is reset when aQISKitError
is raised.The number of processes to spawn is set automatically to the number of physical cpus on the local machine. Discovering this value on Windows requires the use of the
comtypes
module. Although this is an extra dependency, it is installed by default in Anaconda on Windows.