Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
# Note that we only support automerge on branches that have required checks.
branches:
- master
- main
- feature/*
types:
- labeled
Expand All @@ -19,7 +19,7 @@ on:
pull_request_review:
# Note that we only support automerge on branches that have required checks.
branches:
- master
- main
- feature/*
types:
- submitted
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/qdk-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Sync QDK repos

on:
push:
branches:
- main

jobs:
sync-repos:
runs-on: ubuntu-latest
steps:
- name: Login to Azure
uses: Azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- id: AzureKeyVault
uses: Azure/get-keyvault-secrets@v1.0
with:
keyvault: 'kv-qdk-build'
secrets: 'qdkBuildPAT'

- name: 'Trigger QDK sync build'
uses: Azure/pipelines@releases/v1
with:
azure-devops-project-url: 'https://dev.azure.com/ms-quantum-public/Microsoft Quantum (public)'
azure-pipeline-name: 'microsoft.qdk.sync'
azure-devops-token: ${{ steps.AzureKeyVault.outputs.qdkBuildPAT }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You may also visit our [Quantum](https://github.com/microsoft/quantum) repositor

## Building from Source ##

[![Build Status](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_apis/build/status/microsoft.qsharp-runtime?branchName=master)](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_build/latest?definitionId=15&branchName=master)
[![Build Status](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_apis/build/status/microsoft.qsharp-runtime?branchName=main)](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_build/latest?definitionId=15&branchName=main)


Note that when building from source, this repository is configured so that .NET Core will automatically look at the [Quantum Development Kit prerelease feed](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_packaging?_a=feed&feed=alpha) in addition to any other feeds you may have configured.
Expand Down
12 changes: 9 additions & 3 deletions build/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: $(Build.Major).$(Build.Minor).$(date:yyMM).$(DayOfMonth)$(rev:rr)
trigger:
- master

trigger: none

pr:
- main
- feature/*
- features/*
- release/*

variables:
Build.Major: 0
Expand Down Expand Up @@ -28,4 +34,4 @@ jobs:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:
failOnAlert: true
failOnAlert: true
33 changes: 33 additions & 0 deletions build/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: $(Build.Major).$(Build.Minor).$(date:yyMM).$(BuildId)

parameters:
- name: validation_level
displayName: Validation Level
type: string
default: normal
values:
- minimal
- normal
- full

trigger: none

pr:
- main
- feature/*
- features/*
- release/*

resources:
repositories:
- repository: qdk
type: github
endpoint: github
name: microsoft/qdk
ref: refs/heads/main

extends:
template: build/qdk-module-e2e.yml@qdk
parameters:
module: qsharp-runtime
validation_level: ${{ parameters.validation_level }}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public WorkspaceClientException(
$"ResourceGroupName: {resourceGroupName}{Environment.NewLine}" +
$"WorkspaceName: {workspaceName}{Environment.NewLine}" +
$"BaseUri: {baseUri}{Environment.NewLine}" +
$"JobId: {jobId}",
$"JobId: {jobId}{Environment.NewLine}" +
(inner != null ? $"Inner Exception: {inner}" : string.Empty),
inner)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static class QuantumMachineFactory
var machineName =
targetName is null
? null
: targetName.StartsWith("qci.")
? "Microsoft.Quantum.Providers.QCI.Targets.QCIQuantumMachine, Microsoft.Quantum.Providers.QCI"
: targetName.StartsWith("ionq.")
? "Microsoft.Quantum.Providers.IonQ.Targets.IonQQuantumMachine, Microsoft.Quantum.Providers.IonQ"
: targetName.StartsWith("honeywell.")
Expand Down
7 changes: 2 additions & 5 deletions src/Simulation/Common/AbstractFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

using System;
using System.Collections.Generic;
using System.Linq;

using Microsoft.Quantum.Simulation.Core;

namespace Microsoft.Quantum.Simulation.Common
{
Expand All @@ -18,8 +15,8 @@ namespace Microsoft.Quantum.Simulation.Common
/// </summary>
public abstract class AbstractFactory<T>
{
private Dictionary<Type, Type> opsOverrides = new Dictionary<Type, Type>();
private Dictionary<Type, T> opsCache = new Dictionary<Type, T>();
protected Dictionary<Type, Type> opsOverrides = new Dictionary<Type, Type>();
protected Dictionary<Type, T> opsCache = new Dictionary<Type, T>();

/// <summary>
/// Register an override for the given operation.
Expand Down
25 changes: 25 additions & 0 deletions src/Simulation/Common/OperationException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Runtime.CompilerServices;

#nullable enable

namespace Microsoft.Quantum.Simulation.Common
{
/// <summary>
/// A class that implements exception to be thrown when Operation is not supported.
/// </summary>
public class UnsupportedOperationException : PlatformNotSupportedException
{
public UnsupportedOperationException(string text = "",
[CallerFilePath] string file = "",
[CallerMemberName] string member = "",
[CallerLineNumber] int line = 0)
: base($"{file}::{line}::[{member}]:{text}")
{
}
}

}
51 changes: 7 additions & 44 deletions src/Simulation/Common/QuantumProcessorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Licensed under the MIT License.

using System;
using System.Linq;
using Microsoft.Quantum.Simulation.Core;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace Microsoft.Quantum.Simulation.Common
{
Expand Down Expand Up @@ -179,37 +178,16 @@ public virtual void Reset(Qubit qubit)
throw new UnsupportedOperationException();
}

public virtual long StartConditionalStatement(IQArray<Result> measurementResults, IQArray<Result> resultsValues)
public virtual long StartConditionalStatement(IQArray<Result> results1, IQArray<Result> results2)
{
if (measurementResults == null) { return 1; };
if (resultsValues == null) { return 1; };
Debug.Assert(measurementResults.Count == resultsValues.Count);
if (measurementResults.Count != resultsValues.Count) { return 1; };

int equal = 1;

for (int i = 0; i < measurementResults.Count; i++)
{
if (measurementResults[i] != resultsValues[i])
{
equal = 0;
}
}

return equal;
if (results1 == null) { return results2 == null ? 1 : 0; };
if (results1.Count != results2?.Count) { return 0; };
return results1.Zip(results2, (r1, r2) => (r1, r2)).Any(pair => pair.r1 != pair.r2) ? 0 : 1;
}

public virtual long StartConditionalStatement(Result measurementResult, Result resultValue)
public virtual long StartConditionalStatement(Result result1, Result result2)
{

if (measurementResult == resultValue)
{
return 1;
}
else
{
return 0;
}
return result1 == result2 ? 1 : 0;
}

public virtual bool RunThenClause(long statement)
Expand All @@ -234,7 +212,6 @@ public virtual bool RepeatElseClause(long statement)

public virtual void EndConditionalStatement(long id)
{

}

public virtual void Assert(IQArray<Pauli> bases, IQArray<Qubit> qubits, Result result, string msg)
Expand Down Expand Up @@ -286,18 +263,4 @@ public virtual void OnMessage(string msg)
}

}

/// <summary>
/// A class that implements exception to be thrown when Operation is not supported by a QuantumProcessor.
/// </summary>
public class UnsupportedOperationException : PlatformNotSupportedException
{
public UnsupportedOperationException(string text = "",
[CallerFilePath] string file = "",
[CallerMemberName] string member = "",
[CallerLineNumber] int line = 0)
: base($"{file}::{line}::[{member}]:{text}")
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,4 @@ namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Implementati
operation ForceMeasure (observable : Pauli[], target : Qubit[], result : Result) : Unit {
body intrinsic;
}

}
Loading