Skip to content

Add set target program type method to QbraidDevice#952

Merged
ryanhill1 merged 4 commits intomainfrom
rh1-set-target-spec
Apr 16, 2025
Merged

Add set target program type method to QbraidDevice#952
ryanhill1 merged 4 commits intomainfrom
rh1-set-target-spec

Conversation

@ryanhill1
Copy link
Copy Markdown
Member

Summary of changes

  • Added QbraidDevice.set_target_program_type, allowing you to set a specific ProgramSpec (from TargetProfile) alias as the default. For example, if a device supports both "qasm2" and "qasm3", you can now restrict transpilation to one format:
from qbraid.runtime import IonQProvider

provider = IonQProvider()

device = provider.get_device("simulator")

device.metadata()["runtime_config"]["target_program_type"] # ['qasm2', 'qasm3']

device.set_target_program_type("qasm2")

device.metadata()["runtime_config"]["target_program_type"] # 'qasm2'

However the original TargetProfile.program_spec value remains frozen:

device.profile.program_spec
# [<ProgramSpec('builtins.str', 'qasm2')>,
#  <ProgramSpec('builtins.str', 'qasm3')>]

@ryanhill1 ryanhill1 marked this pull request as ready for review April 16, 2025 16:27
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@ryanhill1 ryanhill1 merged commit 7dcead5 into main Apr 16, 2025
14 checks passed
@ryanhill1 ryanhill1 deleted the rh1-set-target-spec branch April 16, 2025 16:39
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

Successfully merging this pull request may close these issues.

1 participant