* Set an explicit random hashseed for tests in CI
The python hash seed is used to control the seed for the hash() function
for types covered by hash randomization. If we encounter errors around
ordering for things like iterating over dictionaries to reproduce
failures locally it is useful to know what the hash seed was. However,
to ensure the code is robust we still want to have a random value for
the hash seed to make sure things aren't dependent on a single order.
This commit accomplishes this by explicitly selecting a random number
and setting that to the value of PYTHONHASHSEED. This value is then
printed right before we run the tests. This way if we encounter an issue
around ordering we can try and reproduce it locally.
* Use python for random number instead of shuf
* Fix typo
* fix#2818; change schedule.union not to increase depth of schedule tree
* Apply suggestions from code review
Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>
* fix timeslots.merged->merge
* keep the implementation out of the docs
* Fix barrier placement in latex visualization (#2918)
* Problem - When barrier op was encountered, barrier command was
placed in a new column followed by \qw element. Barrier location
in the circuit drawn depends on the width of the next column. Because
column width varies depending on the gate type, barrier location
also varies and it is not always placed in the column space alloted for
it. Hence for wider gates barrier used to overlap over the gate
diagram.
* Solution added with this commit - In the new column, only \qw
element is placed. \barrier command with horizontal offset set as
0em is added to the previous column. Now barrier command will be
drawn in the centre of the new column.
* Remove codeblocks relatedi to barrier offset adjustment (#2918)
* These code blocks are not triggered anymore with
the way barrier is placed in the xy-matrix currently.
* new reference files
* drop the not matching files
* inputs
* linux and mac
* another one fails
* new ref file
* do not save
* do not remove
* windows
* different refs for different os
* shorter lines
* remove ref
* new refernces
* udpate ref
* clean the azure conf
* moving the env to Makefile
* azure results
* ref image
* make test_ci
* at import time
* the other test
* clean up and new ref
* save for windows
* new ref
* clean up azure conf
* removing backend selection in qiskit/visualization/matplotlib.py
* add backend selection in testing
* lint
* tight
* backend in ci
* .
* drop
* do not remove and copy
* copy results
* save everything
* new ref
* skip these tests if matplotlib is not installed
* TestGraphDist only if HAS_MATPLOTLIB
* lint
* only under failing condition
* new ref
* rest of the artifacts
* Update azure-pipelines.yml
* twice in the same job
* Fix stray whitespace yaml syntax issue
* display name
Previously the graphivz availablity check was performed at import time.
This meant that everytime anyone imported anything from qiskit.* we'd be
shelling out to try and run 'dot -V' to see if python could find
graphviz in order to run the passmanager drawer. This was based on the
model we used for matplotlib which also does it at import time. However,
unlike matplotlib this isn't a simple python import path check shelling
out and running another program takes a non-negligble amount of time to
any import of qiskit. [1] We shouldn't force this check to run all the
time if graphviz is only needed when running the pass manager
visualizer. This commit address this by switching the graphviz check to
be the first operation that occurs in the pass_manager_drawer() function
instead of at the module level. There is no change in behavior except
for when the check is run. However, since this check was used for
testing and is needed to occur at import time for the test module the
check is duplicated in the test code to ensure we can properly skip
tests if graphviz is not present.
[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=2d14c1e3
We have had the jsonschema version capped since it was introduced as a
requirement into terra. There is no clear reason for this and it limits
interoperability with other python packages. Especially because
jsonschema is commonly used library across the python ecosystem. The
version we were capping to was also quite old being release 2.5 years
ago. This commit removes the cap so that people can run terra in
environments where newer jsonschema is required.
The release note for the delay was added right before the release and we
missed moving it into the 0.9 dir. This doesn't actually matter from the
reno perspective because reno uses git to determine which release an
individual note file is associated with. So when reno is used to
generate the rst for the 0.9 release the directory doesn't matter (as
long as it's under releasenotes/notes). However, to keep things better
organized for humans on disk keeping the release notes associated with
particular major release in a release specific directory. This commit
just moves the note into the 0.9 directory so we can keep the
releasenotes/notes directory just for the pending release.
Now that qiskit-terra 0.9.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
Three new features were added to the user config file in #2366, #2344,
and #2331 but there were no release notes documenting these new
features. This commit corrects the oversight and adds a release note to
document the new features.
In #2965 we added a new visualization function, plot_error_map(), but
that PR was original proposed prior to our adoption of reno to handle
release notes. Therefore it was missing the corresponding release
documentation for the new feature. This commit address that oversignt
and adds a release note for this new feature.
* Adjust logger used for transpile log_level
When the log_level parameter is set on the transpile() call we use that
to set the level for all the transpiler functions called. To do this we
get an instance of the pass manager logger and set the level of logs
we want. However, the logger we were getting before was too specific,
it was only looking at qiskit.transpiler.passmanager, but log messages
are emitted from passes and other functions in qiskit.transpiler too. So
when a log level was set on transpile() calls it was only partially
respected. This commit fixes this by adjusting the logger we set the
level on to be all of qiskit.transpiler instead of just the passmanager
module.
Fixes#3010
* Remove log_level kwarg and update release notes
The log_level kwarg is rendundant when users can just call
logging.getLogger('qiskit.transpiler').setLevel() from their code
directly just as easily. Since the transpile() signature is a stable
interface this errs on the side of caution and removes this kwarg. If we
have a need for logging related kwargs on transpile() in the future we
can easily add them in a future release. At the same time this updates
the release notes to provide more background on how to use logging.
* Fix lint
* faster pauli to spmatrix
* Faster pauli to matrix using bitwise operations
* Correct length operator
* missing self
* Added documentation to _count_set_bits
* count_set_bits
* fast count_set_bits
* bug fix count_set_bits
* trying to fix some of your lint errors
* two more listing errors
* Add reno release notes for 0.9 release
This commit starts the process of adding release notes using reno to
qiskit-terra. This notes for several of the user facing changes in the
0.9 release so far. We can continue to modify release notes after the fact
because they're tied to the git history for which release they're
associated with. New release notes can be added with: "reno new $name"
and you can generate rst output using "reno report"
Moving forward the expectation is that we'll require a PR to include
release documentation in the form of a reno release note before we merge
it, if it contains a user facing change. Release notes differ from
changelog in that they provide much more detail to end users on what has
changed, how they can adapt to it, and why it was changed (if
necessary). Accordingly the release notes are free form restructured text
that enables writing as much as needed. While the changelog is just a
record of a change that has potential end user impact and normally
doesn't provide the detail needed by users. Honestly the changelog
creation shouldn't be a manual process it should be automatically
generated using a combination of git and commit msg metadata.
Fixes#2230
* Add more release notes
* Add more release notes for new features
* Add more release notes
* Add more upgrade notes
* Add reno lint check to CI
* Add more notes
* Add release notes for changes that were missing a changelog entry
* Expand incomplete notes
* Fix whitespace
* Add documentation on release notes to CONTRIBUTING.md
* Add qsphere update release notes
* Update diagGate() name to diag_gate()
* Add release notes for pulse samplers
* Add release notes for layout in circuit drawers
* Add upgrade note about new warnings
* Replace stray hardtab with spaces
* Add release note on line magic api change
* Apply suggestions from code review
Co-Authored-By: Luciano <luciano.bello@ibm.com>
* Update CONTRIBUTING.md
Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Fix typo
* Fixes#2858 by checking the entire instruction for classical registers, not just the first gate in it.
* lint decompose.py
* Update unroll_3q_or_more.py
* lint unroller.py
* Fix passing of kwargs to the compiler assembler
The use of assemble() from the execute function in
https://github.com/Qiskit/qiskit-terra/blame/master/qiskit/execute.py#L218
passes run_config as a named parameter when assemble expects it as
kwargs. This causes it to be packed into a dict with a single run_config
key that is never unpacked.
* Update assemble function doc to clarify run_config as a kwargs param
* Modified timeslots to perform more efficient insertions.
* Reorder functions.
* Reset util.
* Redefine intervals by start and stop rather than begin and end.
* Update docstrings of timeslots.
* Add interval methods to timeslot.
* Update methods to use new timeslot methods rather than underlying interval methods.
* linting.
* Localize timeslotcollection try statement.
* Change dumb way of returning booleans.
* Improve locality check.
* fix bubble vs insertion sort comment
* Remove le,ge and starts_after and stops_after methods.
* Change timeslot collection merging to not use sets.
* Update mergeable method.
* Readd channel start and stop at 0 if no instructions are present
* Simplify logic in _merge_timeslot_collection
* Fix bug: cant set timeslots, need to copy them
* Limit the set of tests run in appveyor
The py37 job run in appveyor isn't meant to actually count, it's
there so appveyor won't leave a pending job sitting in the github
checks list while we have it configured as a wheel building backup
for azure. Right now this job is failing and leaving a red x on commits
(which is at least as bad as leaving patches status as pending) because
of a new pulse test that is sensitive to subtle floating point type
differences between environments. To avoid the bad optics of a red x on
jobs we don't care about this commit switches the set of tests we run in
this job we only configured to make it easy to ignore to just a single
test module that is unlikely to fail unless it fails on all
environments.
* Don't run anything
* Add appveyor config back for building windows wheels
With the recent instability and unreliability with azure-pipelines
relying on it to build our windows wheels for the upcoming 0.9 release
doesn't seem to be prudent. Especially when considering our ability to
create reliable portable wheels for a windows environment manually
outside of CI is limited (we've had issues trying to do it manually in
the past). This commit adds back our appveyor config for building wheels
which has worked well for past releases. This way even if azure fails
for us we have a fallback available when we push our release tag.
* Do not merge, verifying it still works
* Revert "Do not merge, verifying it still works"
This reverts commit 285bfbb12c.
* Upload artifacts even if build fails
* Add back one job so it doesn't sit pending forever
The appveyor ci system doesn't like a config with 0 jobs configured to
run. If no jobs are configured to run it will sit there forever as
pending state. Since we only want to run the wheel build jobs on tags if
we only had the wheel jobs in the config this would result in an
appveyor entry in the checks on github sitting in a pending state
forever. To avoid this problem this commit adds a normal test job that
will run python 3.7 job so something will come back. We can safetly
ignore this job since it's duplicated with with what we run in azure,
but it will at least mean we're not leaving a PR in the pending state
forever.
* Use ps backend for mpl tests
Parameters were defined such that they would only ever __eq__ self. That way,
if a user defined a Parameter('theta') and wanted to compose in a subcircuit
defined elsewhere which contained a different Parameter('theta'), we would
be able to detect that the parameter names overlapped and raise an error.
However, if a user sent a Parameter to a different python instance though (say
through multiprocessing.Pool or qiskit.tools.parallel_map), it would be
instantiated as a different python object and so no longer be considered equal
to the original parameter.
This PR changes Parameter to instead generate a random UUID on
instantiation and use that for equality testing. Unlike id(self), self._uuid will be
preserved across pickling and de-pickling, but should otherwise preserve
Parameter's equality behavior.
Fixes#2429Fixes#2864
In #2905 we switched the macOS jobs only use a concurrency of 2 instead
of nprocs for running tests. This was done in an attempt to debug a
segfault (which wasn't easy to diagnose from CI). But as #2793 has shown
the issue isn't the concurrency but instead running on macOS 10.14.
Since we also downgraded the macOS version used for these jobs we
shouldn't need to limit the concurrency anymore and increase it back to
4 workers. This should hopefully improve the test runtime on macOS jobs
slightly since they report having 4 CPUs available.
Right now the latex drawer has a few instances of deprecated bit access
assuming a tuple right now. This results in a deprecation warning when
calling the latex drawer. To avoid emitting a deprecation warning
internally from qiskit this commit fixes this and updates the access
to use the bit class attributes.