зеркало из https://github.com/microsoft/iqsharp.git
Remove Honeywell provider and update tests to use Quantinuum
This commit is contained in:
Родитель
8beb05f4ca
Коммит
3115f94a7c
|
@ -15,9 +15,6 @@ internal enum AzureProvider
|
|||
Microsoft,
|
||||
IonQ,
|
||||
Quantinuum,
|
||||
// NB: This provider name is deprecated, but may exist in older
|
||||
// workspaces and should still be supported.
|
||||
Honeywell,
|
||||
QCI,
|
||||
Rigetti,
|
||||
Mock
|
||||
|
@ -48,8 +45,7 @@ public record AzureExecutionTarget
|
|||
public virtual string PackageName => GetProvider(TargetId) switch
|
||||
{
|
||||
AzureProvider.IonQ => "Microsoft.Quantum.Providers.IonQ",
|
||||
AzureProvider.Quantinuum => "Microsoft.Quantum.Providers.Honeywell",
|
||||
AzureProvider.Honeywell => "Microsoft.Quantum.Providers.Honeywell",
|
||||
AzureProvider.Quantinuum => "Microsoft.Quantum.Providers.Quantinuum",
|
||||
AzureProvider.QCI => "Microsoft.Quantum.Providers.QCI",
|
||||
AzureProvider.Microsoft => "Microsoft.Quantum.Providers.Core",
|
||||
_ => $"Microsoft.Quantum.Providers.{GetProvider(TargetId)}"
|
||||
|
@ -64,7 +60,6 @@ public record AzureExecutionTarget
|
|||
{
|
||||
AzureProvider.IonQ => TargetCapabilityModule.BasicQuantumFunctionality,
|
||||
AzureProvider.Quantinuum => TargetCapabilityModule.BasicMeasurementFeedback,
|
||||
AzureProvider.Honeywell => TargetCapabilityModule.BasicMeasurementFeedback,
|
||||
AzureProvider.QCI => TargetCapabilityModule.AdaptiveExecution,
|
||||
AzureProvider.Rigetti => TargetCapabilityModule.BasicExecution,
|
||||
AzureProvider.Microsoft => TargetCapabilityModule.FullComputation,
|
||||
|
@ -80,7 +75,7 @@ public record AzureExecutionTarget
|
|||
// but at the level of providers rather than at the level of resolved processors.
|
||||
(GetProvider(TargetId) switch
|
||||
{
|
||||
AzureProvider.Quantinuum or AzureProvider.Honeywell => new[]
|
||||
AzureProvider.Quantinuum => new[]
|
||||
{
|
||||
TargetCapabilityModule.AdaptiveExecution,
|
||||
TargetCapabilityModule.BasicMeasurementFeedback,
|
||||
|
|
|
@ -219,7 +219,7 @@ public partial class CompilerService
|
|||
bool Matches(string pattern) =>
|
||||
target?.Contains(pattern, StringComparison.InvariantCultureIgnoreCase) ?? false;
|
||||
|
||||
if (Matches("quantinuum") || Matches("honeywell") && capability is { ClassicalCompute: var classical } && classical != ClassicalComputeModule.Full)
|
||||
if (Matches("quantinuum") && capability is { ClassicalCompute: var classical } && classical != ClassicalComputeModule.Full)
|
||||
{
|
||||
return "Microsoft.Quantum.Type1.Core";
|
||||
}
|
||||
|
|
|
@ -84,16 +84,10 @@ namespace Tests.IQSharp
|
|||
Assert.AreEqual(targetId, executionTarget?.TargetId);
|
||||
Assert.AreEqual("Microsoft.Quantum.Providers.IonQ", executionTarget?.PackageName);
|
||||
|
||||
// Check that deprecated targets still work.
|
||||
targetId = "HonEYWEll.targetId";
|
||||
executionTarget = AzureExecutionTarget.Create(targetId);
|
||||
Assert.AreEqual(targetId, executionTarget?.TargetId);
|
||||
Assert.AreEqual("Microsoft.Quantum.Providers.Honeywell", executionTarget?.PackageName);
|
||||
|
||||
targetId = "QuantiNUUm.targetId";
|
||||
executionTarget = AzureExecutionTarget.Create(targetId);
|
||||
Assert.AreEqual(targetId, executionTarget?.TargetId);
|
||||
Assert.AreEqual("Microsoft.Quantum.Providers.Honeywell", executionTarget?.PackageName);
|
||||
Assert.AreEqual("Microsoft.Quantum.Providers.Quantinuum", executionTarget?.PackageName);
|
||||
|
||||
targetId = "qci.target.name.qpu";
|
||||
executionTarget = AzureExecutionTarget.Create(targetId);
|
||||
|
@ -170,7 +164,7 @@ namespace Tests.IQSharp
|
|||
// set up the mock workspace
|
||||
var azureWorkspace = azureClient.ActiveWorkspace as MockAzureWorkspace;
|
||||
Assert.IsNotNull(azureWorkspace);
|
||||
azureWorkspace?.AddProviders("ionq", "honeywell", "quantinuum", "unrecognized");
|
||||
azureWorkspace?.AddProviders("ionq", "quantinuum", "unrecognized");
|
||||
|
||||
// get connection status to verify list of targets
|
||||
targets = ExpectSuccess<IEnumerable<TargetStatusInfo>>(azureClient.GetConnectionStatusAsync(new MockChannel()));
|
||||
|
@ -196,8 +190,8 @@ namespace Tests.IQSharp
|
|||
[DataTestMethod]
|
||||
[DataRow("--clear", "--clear", ExecuteStatus.Ok)]
|
||||
[DataRow("--clear", "FullComputation", ExecuteStatus.Ok)]
|
||||
[DataRow("honeywell.mock", "FullComputation", ExecuteStatus.Error)]
|
||||
[DataRow("honeywell.mock", "BasicMeasurementFeedback", ExecuteStatus.Ok)]
|
||||
[DataRow("quantinuum.mock", "FullComputation", ExecuteStatus.Error)]
|
||||
[DataRow("quantinuum.mock", "BasicMeasurementFeedback", ExecuteStatus.Ok)]
|
||||
[DataRow("quantinuum.mock", "AdaptiveExecution", ExecuteStatus.Ok)]
|
||||
public async Task TestManualCapabilities(string targetId, string capabilityName, ExecuteStatus expectedResult) =>
|
||||
await Assert.That
|
||||
|
@ -214,7 +208,7 @@ namespace Tests.IQSharp
|
|||
CredentialType.Environment);
|
||||
Assert.IsNotNull(client.ActiveWorkspace);
|
||||
((MockAzureWorkspace)client.ActiveWorkspace)
|
||||
.AddProviders("ionq", "honeywell", "quantinuum", "unrecognized");
|
||||
.AddProviders("ionq", "quantinuum", "unrecognized");
|
||||
})
|
||||
.Input("%azure.connect " +
|
||||
"subscription=TEST_SUBSCRIPTION_ID " +
|
||||
|
@ -393,7 +387,6 @@ namespace Tests.IQSharp
|
|||
|
||||
[DataTestMethod]
|
||||
[DataRow("ionq.mock", AzureClientError.InvalidEntryPoint)]
|
||||
[DataRow("honeywell.mock", null)]
|
||||
[DataRow("quantinuum.mock", null)]
|
||||
public async Task TestRuntimeCapabilities(string targetId, AzureClientError? expectedError)
|
||||
{
|
||||
|
@ -409,7 +402,7 @@ namespace Tests.IQSharp
|
|||
// Set up workspace with mock providers
|
||||
var azureWorkspace = azureClient.ActiveWorkspace as MockAzureWorkspace;
|
||||
Assert.IsNotNull(azureWorkspace);
|
||||
azureWorkspace?.AddProviders("ionq", "honeywell", "quantinuum");
|
||||
azureWorkspace?.AddProviders("ionq", "quantinuum");
|
||||
|
||||
// Verify that IonQ job fails to compile (QPRGen0)
|
||||
ExpectSuccess<TargetStatusInfo>(azureClient.SetActiveTargetAsync(new MockChannel(), targetId));
|
||||
|
|
|
@ -956,8 +956,6 @@ namespace Tests.IQSharp
|
|||
.Input(source)
|
||||
.ExecutesSuccessfully()
|
||||
.WithMockAzure()
|
||||
.Input("%azure.target honeywell.mock")
|
||||
.ExecutesSuccessfully()
|
||||
.Input("%azure.target quantinuum.mock")
|
||||
.ExecutesSuccessfully()
|
||||
.Input("%azure.submit RunTeleport")
|
||||
|
|
|
@ -52,7 +52,7 @@ internal static class TestExtensions
|
|||
var client = await (await engine).Engine.GetEngineService<IAzureClient>();
|
||||
if (client is AzureClient azureClient && azureClient.ActiveWorkspace is MockAzureWorkspace workspace)
|
||||
{
|
||||
workspace.AddProviders("ionq", "quantinuum", "honeywell");
|
||||
workspace.AddProviders("ionq", "quantinuum");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"Microsoft.Quantum.Research::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.Core::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.IonQ::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.Honeywell::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.Quantinuum::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.QCI::0.26.230380-beta",
|
||||
"Microsoft.Quantum.Providers.Rigetti::0.26.230380-beta"
|
||||
]
|
||||
|
|
|
@ -59,11 +59,6 @@ Describe "Test Python Integration" {
|
|||
$LASTEXITCODE | Should -Be 0
|
||||
}
|
||||
|
||||
It "Runs pytest successfully for honeywell" -Tag "submit.honeywell" {
|
||||
python -m pytest -k honeywell --junitxml="junit/TestResults-Honeywell.xml" | Write-Verbose
|
||||
$LASTEXITCODE | Should -Be 0
|
||||
}
|
||||
|
||||
It "Runs pytest successfully for Quantinuum" -Tag "submit.quantinuum" {
|
||||
python -m pytest -k quantinuum --junitxml="junit/Quantinuum.xml" | Write-Verbose
|
||||
$LASTEXITCODE | Should -Be 0
|
||||
|
|
|
@ -128,54 +128,6 @@ def quantinuum_project():
|
|||
|
||||
@pytest.mark.usefixtures("quantinuum_project")
|
||||
class TestQuantinuum:
|
||||
def test_honeywell_targets(self):
|
||||
"""
|
||||
Tests that we can fetch targets from the service,
|
||||
and that the workspace includes the targets we need for submission
|
||||
"""
|
||||
targets = connect()
|
||||
assert len(targets) > 2
|
||||
|
||||
target_ids = [t.id for t in targets]
|
||||
assert 'honeywell.hqs-lt-s1' in target_ids
|
||||
assert 'honeywell.hqs-lt-s1-apival' in target_ids
|
||||
|
||||
def test_honeywell_submit(self):
|
||||
"""
|
||||
Test that the RunTeleport operation can be submitted successfully on the honeywell apival target
|
||||
"""
|
||||
import qsharp
|
||||
from Microsoft.Quantum.Tests import RunTeleport
|
||||
|
||||
# Make sure we can simulate locally:
|
||||
expected = True
|
||||
result = RunTeleport.simulate(doPlus=expected)
|
||||
assert result == 0 if expected else 1
|
||||
|
||||
import qsharp.azure
|
||||
connect()
|
||||
|
||||
t = qsharp.azure.target("honeywell.hqs-lt-s1-apival")
|
||||
assert isinstance(t, qsharp.azure.AzureTarget)
|
||||
assert t.id == "honeywell.hqs-lt-s1-apival"
|
||||
|
||||
job = qsharp.azure.submit(RunTeleport, doPlus=expected)
|
||||
assert isinstance(job, qsharp.azure.AzureJob)
|
||||
assert not job.id == ''
|
||||
print("Submitted job: ", job.id)
|
||||
|
||||
try:
|
||||
wait_until_completed(job)
|
||||
except TimeoutError:
|
||||
warnings.warn("Honeywell execution exceeded timeout. Skipping fetching results.")
|
||||
else:
|
||||
job = qsharp.azure.status()
|
||||
assert isinstance(job, qsharp.azure.AzureJob)
|
||||
if job.status == "Succeeded":
|
||||
retrieved_histogram = qsharp.azure.output()
|
||||
assert isinstance(retrieved_histogram, dict)
|
||||
assert '0' in retrieved_histogram
|
||||
|
||||
def test_quantinuum_targets(self):
|
||||
"""
|
||||
Tests that we can fetch targets from the service,
|
||||
|
|
|
@ -17,7 +17,7 @@ To run these tests:
|
|||
* `NUGET_OUTDIR`: with the location of the build's NuGet packages
|
||||
* `NUGET_VERSION`: with the packages' NuGet version.
|
||||
* `PYTHON_OUTDIR`: with the location of the build's Python wheels
|
||||
2. Set up the following environment variables pointing to an Azure Quantum Workspace that has the Microsoft, IonQ and Honeywell providers enabled:
|
||||
2. Set up the following environment variables pointing to an Azure Quantum Workspace that has the Microsoft, IonQ and Quantinuum providers enabled:
|
||||
* `$Env:AZURE_QUANTUM_SUBSCRIPTION_ID=""`
|
||||
* `$Env:AZURE_QUANTUM_WORKSPACE_RG=""`
|
||||
* `$Env:AZURE_QUANTUM_WORKSPACE_LOCATION=""`
|
||||
|
|
Загрузка…
Ссылка в новой задаче