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

Dev gate applicator #193

Merged
merged 22 commits into from
Mar 21, 2023
Merged

Dev gate applicator #193

merged 22 commits into from
Mar 21, 2023

Conversation

shahidee44
Copy link
Collaborator

@shahidee44 shahidee44 commented Mar 2, 2023

Description

  • Changed the way Gate Objects are structured. Each non-core openqaoa module will need a GateApplicator object which contains library specific functions on how the gates are applied to the circuit. The Gate Object now acts as an interface.
  • Each Backend now creates a GateApplicator Object that, together with the Gate Object apply the right library gate to the Backend's internal circuit
  • The implementation of GateApplicator for Qiskit, Braket and Pyquil backends.
  • Dynamic generation of constants: DEVICE_NAME_TO_OBJECT_MAPPER , DEVICE_ACCESS_OBJECT_MAPPER. Based on the presence of the particular module.
  • get_qaoa_backend and create_device updated to dynamically find a module if it has been installed.
  • plugin_finder.py is added which helps facilitate the function needed to dynamically find modules within the environment.
  • Updated test_gates.py unittests
  • Added test_gate_applicator_qiskit.py unittests
  • Added test_gate_applicator_braket.py unittests
  • Added test_gate_applicator_pyquil.py unittests
  • Added test_gate_applicator_vectorized.py unittests
  • Edited setup.py to include entry_points which will be used by plugins to interact with core code.
  • Removed core code dependency on any plugin

Checklist

  • I have performed a self-review of my code.
  • I have commented my code and used numpy-style docstrings
  • I have made corresponding updates to the documentation.
  • My changes generate no new warnings
  • I have added/updated tests to make sure bugfix/feature works.
  • New and existing unit tests pass locally with my changes.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Name the new unit-tests that you have added along with this change.

run all tests.

@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Merging #193 (cfe711d) into dev (985ad99) will decrease coverage by 0.10%.
The diff coverage is 96.85%.

@@            Coverage Diff             @@
##              dev     #193      +/-   ##
==========================================
- Coverage   97.81%   97.72%   -0.10%     
==========================================
  Files          33       37       +4     
  Lines        6325     6769     +444     
==========================================
+ Hits         6187     6615     +428     
- Misses        138      154      +16     
Impacted Files Coverage Δ
setup.py 100.00% <ø> (ø)
tests/test_backends.py 51.47% <0.00%> (-1.56%) ⬇️
tests/test_gate_applicators_vectorized.py 92.23% <92.23%> (ø)
tests/test_gate_applicators_braket.py 98.18% <98.18%> (ø)
tests/test_gate_applicators_pyquil.py 98.19% <98.19%> (ø)
tests/test_gate_applicators_qiskit.py 98.21% <98.21%> (ø)
tests/test_gates.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@vishal-ph
Copy link
Collaborator

Since, I proposed the design in this PR, it makes sense that either @raulconchello, @Q-lds, be the primary reviewer of this PR. I am adding you both for now. I will be reviewing it too

@Q-lds Q-lds added the enhancement New feature or request label Mar 9, 2023
@vishal-ph
Copy link
Collaborator

NOTE: If not done yet, run black formatter before merging

@vishal-ph vishal-ph marked this pull request as ready for review March 20, 2023 06:01
@vishal-ph vishal-ph merged commit 464dbe8 into dev Mar 21, 2023
@vishal-ph vishal-ph deleted the dev_gate_applicator branch March 21, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants