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
Show all changes
29 commits
Select commit Hold shift + click to select a range
bd1f2cb
Fix NUGET_VERSION issues (#251)
Jun 13, 2020
73fad8b
removed sync over async in LazyAsync (#238)
filipw Jun 15, 2020
fe774c7
[Workspace] Support linked storage accounts (#252)
george-moussa Jun 17, 2020
8914609
Change to allow a qubit to be released if it is measured (#231)
AniketDalvi Jun 17, 2020
afa3b94
Irinayat/readme bootstrap (#260)
IrinaYatsenko Jun 17, 2020
bc2274c
added .vscode folder to .gitignore (#261)
IrinaYatsenko Jun 17, 2020
ecb8c92
Use quotes around variables in shell commands (#268)
bamarsha Jun 19, 2020
a227244
Make --storage option optional for Azure Quantum submissions (#266)
bamarsha Jun 20, 2020
c285352
Fix incorrect reference to running two commands (#269)
bamarsha Jun 20, 2020
8cd4794
Adapting C# generation test (#274)
bettinaheim Jun 20, 2020
8c54abf
Adding props file to C# generation (#271)
bettinaheim Jun 23, 2020
5296a86
Test case for compatible rotations in ToffoliSimulator (#275)
msoeken Jun 23, 2020
4a5862f
Fix C# Generation for UDT Tuple Field (#270)
ScottCarda-MS Jun 23, 2020
c81c679
Run ToString tests within the invariant culture (#273)
bamarsha Jun 23, 2020
ff867d3
Small typo in docs. (#279)
msoeken Jun 23, 2020
1134d4d
Automatically assign libraries maintainers on Q# API. (#259)
Jun 23, 2020
9b15e9e
fix access type (#284)
george-moussa Jun 24, 2020
d78a4d5
Add new MaybeDisplayDiagnostic method to SimBase. (#283)
Jun 25, 2020
a268e08
Confusing output for width and depth from resource estimator (#267)
IrinaYatsenko Jun 25, 2020
6eb9d45
Aggregate results in resource estimator across multiple runs (#264)
IrinaYatsenko Jun 25, 2020
86d3a81
Update C# generation and tests for file path format change (#263)
bamarsha Jun 25, 2020
d7e1d9d
Fix #256. (#257)
Jun 25, 2020
410a794
Improve core Q# API consistency (#286)
Jun 25, 2020
fde97fd
Fix #370. (#287)
Jun 30, 2020
e9bb14f
Missing project properties for entry point driver (#293)
bettinaheim Jul 2, 2020
712cf92
upgraded Roslyn to 3.6.0 (#289)
filipw Jul 5, 2020
86c9021
Port automerge functionality from quantumlibraries. (#288)
Jul 5, 2020
ac319ad
removing unnecessary package references (#295)
bettinaheim Jul 6, 2020
329bcea
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Jul 6, 2020
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Automatically tag in libraries maintainers on Q# API changes.
*.qs @microsoft/quantumlibraries
38 changes: 38 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This action allows using the automerge label to automatically merge in pull requests that have been reviewed and that pass
# status checks (similar to the autocomplete functionality of Azure DevOps).
name: automerge
on:
pull_request:
# Note that we only support automerge on branches that have required checks.
branches:
- master
- feature/*
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
# Note that we only support automerge on branches that have required checks.
branches:
- master
- feature/*
types:
- submitted
check_suite:
types:
- completed
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/automerge-action@4536e8847eb62fe2f0ee52c8fa92d17aa97f932f"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_METHOD: squash
25 changes: 25 additions & 0 deletions Simulation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Simulation", "Simulation",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.QSharp.Foundation", "src\Simulation\QsharpFoundation\Microsoft.Quantum.QSharp.Foundation.csproj", "{50614DF8-2DD8-4A0B-9AA9-7843BA563572}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Simulators.Tests", "Simulators.Tests", "{0E9E6621-B3B9-42F9-AA13-AF97ADA026E9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{3CB6D1AC-C606-433D-8D83-182B4A0475F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library with Spaces", "src\Simulation\Simulators.Tests\TestProjects\Library with Spaces\Library with Spaces.csproj", "{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -409,6 +415,22 @@ Global
{50614DF8-2DD8-4A0B-9AA9-7843BA563572}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU
{50614DF8-2DD8-4A0B-9AA9-7843BA563572}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU
{50614DF8-2DD8-4A0B-9AA9-7843BA563572}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Debug|x64.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Debug|x64.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Release|Any CPU.Build.0 = Release|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Release|x64.ActiveCfg = Release|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.Release|x64.Build.0 = Release|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -437,6 +459,9 @@ Global
{4858E5E3-23FA-4928-B99A-54065875A2B9} = {37CDC768-16D4-4574-8553-07D99D0A72F7}
{83C5FC86-9D37-4679-9D91-66288DD975AE} = {2195B643-E782-42E0-9FB0-26F6D90131E6}
{50614DF8-2DD8-4A0B-9AA9-7843BA563572} = {83C5FC86-9D37-4679-9D91-66288DD975AE}
{0E9E6621-B3B9-42F9-AA13-AF97ADA026E9} = {83C5FC86-9D37-4679-9D91-66288DD975AE}
{3CB6D1AC-C606-433D-8D83-182B4A0475F1} = {0E9E6621-B3B9-42F9-AA13-AF97ADA026E9}
{F366DB0F-EF25-4196-94F1-0FCC9B9DB1B5} = {3CB6D1AC-C606-433D-8D83-182B4A0475F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821}
Expand Down
2 changes: 1 addition & 1 deletion src/Azure/Azure.Quantum.Client/Storage/StorageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public async Task UploadBlobAsync(
try
{
// Ensure container is created
await containerClient.CreateIfNotExistsAsync(PublicAccessType.Blob, cancellationToken: cancellationToken);
await containerClient.CreateIfNotExistsAsync(PublicAccessType.None, cancellationToken: cancellationToken);

// Upload blob
BlobClient blob = containerClient.GetBlobClient(blobName);
Expand Down
2 changes: 1 addition & 1 deletion src/Simulation/Common/IQuantumProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public interface IQuantumProcessor
void Assert(IQArray<Pauli> bases, IQArray<Qubit> qubits, Result result, string msg);

/// <summary>
/// Called when <a href="https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.assertprob">Microsoft.Quantum.Intrinsic.Assert</a> is called in Q#.
/// Called when <a href="https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.assertprob">Microsoft.Quantum.Intrinsic.AssertProb</a> is called in Q#.
/// </summary>
/// <remarks>
/// The names and the order of the parameters is similar to the corresponding Q# operation./
Expand Down
19 changes: 19 additions & 0 deletions src/Simulation/Common/SimulatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public abstract class SimulatorBase : AbstractFactory<AbstractCallable>, IOperat
public event Action<string>? OnLog = null;
public event Action<Exception, IEnumerable<StackFrame>>? OnException = null;


/// <summary>
/// An event fired whenever a simulator has additional diagnostic data
/// available for display (e.g. state information, assertion details,
/// execution traces).
/// </summary>
public event Action<object>? OnDisplayableDiagnostic = null;

public IQubitManager? QubitManager { get; }

public abstract string Name { get; }
Expand Down Expand Up @@ -182,6 +190,17 @@ public void EnableExceptionPrinting()
OnException += WriteStackTraceToLog;
}

/// <summary>
/// Sends diagnostic data to any listening display handlers.
/// Display handlers may discard any unrecognized data, such that
/// no guarantee is made as to any particular action taken as a result
/// of calling this method.
/// </summary>
protected void MaybeDisplayDiagnostic(object data)
{
OnDisplayableDiagnostic?.Invoke(data);
}


/// <summary>
/// Disables default handling of stack traces, such that stack
Expand Down
27 changes: 16 additions & 11 deletions src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ open System
open System.Collections.Immutable
open System.IO
open System.Globalization
open System.Web

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.CSharp
Expand Down Expand Up @@ -218,9 +219,13 @@ namespace N1


let testOneFile fileName (expected:string) =
let expected = expected.Replace("%%%", (Uri(Path.GetFullPath fileName)).AbsolutePath)
let expected = expected.Replace("%%", (Path.GetFullPath fileName).Replace("\\", "\\\\"))
let tree = parse [(Path.Combine("Circuits","Intrinsic.qs")); fileName]
let fullPath = Path.GetFullPath fileName
let escapeCSharpString (s : string) = SymbolDisplay.FormatLiteral (s, false)
let expected =
expected
|> (fun s -> s.Replace("%%%", fullPath |> HttpUtility.JavaScriptStringEncode |> escapeCSharpString))
|> (fun s -> s.Replace("%%", fullPath |> escapeCSharpString))
let tree = parse [Path.Combine ("Circuits", "Intrinsic.qs"); fileName]
let actual =
CodegenContext.Create (tree, ImmutableDictionary.Empty)
|> generate (Path.GetFullPath fileName |> NonNullable<string>.New)
Expand Down Expand Up @@ -2307,7 +2312,7 @@ namespace N1
false |> testOne randomOperation

let testOneClass (_,op : QsCallable) executionTarget (expected : string) =
let expected = expected.Replace("%%%", op.SourceFile.Value)
let expected = expected.Replace("%%%", HttpUtility.JavaScriptStringEncode op.SourceFile.Value)
let assemblyConstants =
new System.Collections.Generic.KeyValuePair<_,_> (AssemblyConstants.ExecutionTarget, executionTarget)
|> Seq.singleton
Expand Down Expand Up @@ -3397,7 +3402,7 @@ using Microsoft.Quantum.Simulation.Core;
#line hidden
namespace Microsoft.Quantum.Tests.Inline
{
[SourceLocation("%%%", OperationFunctor.Body, 7, -1)]
[SourceLocation("%%", OperationFunctor.Body, 7, -1)]
public partial class HelloWorld : Operation<Int64, Int64>, ICallable
{
public HelloWorld(IOperationFactory m) : base(m)
Expand Down Expand Up @@ -3454,7 +3459,7 @@ using Microsoft.Quantum.Simulation.Core;
#line hidden
namespace Microsoft.Quantum.Tests.LineNumbers
{
[SourceLocation("%%%", OperationFunctor.Body, 9, -1)]
[SourceLocation("%%", OperationFunctor.Body, 9, -1)]
public partial class TestLineInBlocks : Operation<Int64, Result>, ICallable
{
public TestLineInBlocks(IOperationFactory m) : base(m)
Expand Down Expand Up @@ -3628,7 +3633,7 @@ namespace Microsoft.Quantum.Diagnostics
#line hidden
namespace Microsoft.Quantum.Tests.UnitTests
{
[SourceLocation("%%%", OperationFunctor.Body, 22, 26)]
[SourceLocation("%%", OperationFunctor.Body, 22, 26)]
public partial class UnitTest1 : Operation<QVoid, QVoid>, ICallable
{
public UnitTest1(IOperationFactory m) : base(m)
Expand All @@ -3651,7 +3656,7 @@ namespace Microsoft.Quantum.Tests.UnitTests
[Xunit.Trait("Target", "QuantumSimulator")]
[Xunit.Trait("Name", "UnitTest1")]
public void UnitTest1()
#line 22 "%%%"
#line 22 "%%"
{
var sim = new Microsoft.Quantum.Simulation.Simulators.QuantumSimulator();
if (sim is Microsoft.Quantum.Simulation.Common.SimulatorBase baseSim && this.Output != null)
Expand Down Expand Up @@ -3683,7 +3688,7 @@ namespace Microsoft.Quantum.Tests.UnitTests
[Xunit.Trait("Target", "ToffoliSimulator")]
[Xunit.Trait("Name", "UnitTest1")]
public void UnitTest1()
#line 22 "%%%"
#line 22 "%%"
{
var sim = new Microsoft.Quantum.Simulation.Simulators.ToffoliSimulator();
if (sim is Microsoft.Quantum.Simulation.Common.SimulatorBase baseSim && this.Output != null)
Expand Down Expand Up @@ -3721,7 +3726,7 @@ namespace Microsoft.Quantum.Tests.UnitTests
}
}

[SourceLocation("%%%", OperationFunctor.Body, 26, -1)]
[SourceLocation("%%", OperationFunctor.Body, 26, -1)]
public partial class UnitTest2 : Operation<QVoid, QVoid>, ICallable
{
public UnitTest2(IOperationFactory m) : base(m)
Expand All @@ -3744,7 +3749,7 @@ namespace Microsoft.Quantum.Tests.UnitTests
[Xunit.Trait("Target", "CustomSimulator")]
[Xunit.Trait("Name", "UnitTest2")]
public void UnitTest2()
#line 26 "%%%"
#line 26 "%%"
{
var sim = new SomeNamespace.CustomSimulator();
if (sim is Microsoft.Quantum.Simulation.Common.SimulatorBase baseSim && this.Output != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.0" />
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.11.2006.2118-beta" />
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.11.2006.3017-alpha" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 3 additions & 6 deletions src/Simulation/CsharpGeneration/SimulationCode.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1573,13 +1573,10 @@ module SimulationCode =
generator.Apply elements

// Returns only those namespaces and their elements that are defined for the given file.
let findLocalElements selector fileName syntaxTree =
let path =
match CompilationBuilder.CompilationUnitManager.TryGetUri fileName with
| true, uri -> uri.AbsolutePath |> NonNullable<string>.New
| false, _ -> NonNullable<string>.New ""
let findLocalElements selector (fileName : NonNullable<string>) syntaxTree =
syntaxTree
|> Seq.map (fun ns -> (ns.Name, (FilterBySourceFile.Apply (ns, path)).Elements |> Seq.choose selector |> Seq.toList))
|> Seq.map (fun ns ->
(ns.Name, (FilterBySourceFile.Apply (ns, fileName)).Elements |> Seq.choose selector |> Seq.toList))
|> Seq.sortBy fst
|> Seq.filter (fun (_,elements) -> not elements.IsEmpty)
|> Seq.toList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<RootNamespace>Microsoft.Quantum.EntryPointDriver.Tests</RootNamespace>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions src/Simulation/EntryPointDriver.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,15 @@ let ``Shadows --shots`` () =

// The expected output from the resources estimator.
let private resourceSummary =
"Metric Sum
CNOT 0
QubitClifford 1
R 0
Measure 1
T 0
Depth 0
Width 1
BorrowedWidth 0"
"Metric Sum Max
CNOT 0 0
QubitClifford 1 1
R 0 0
Measure 1 1
T 0 0
Depth 0 0
Width 1 1
BorrowedWidth 0 0"

[<Fact>]
let ``Supports QuantumSimulator`` () =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<Nullable>enable</Nullable>
<PackageId>Microsoft.Quantum.EntryPointDriver</PackageId>
<Description>The standard command-line interface for standalone Q# console applications.</Description>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<PropertyGroup>
<Authors>Microsoft</Authors>
<Description>Entry point driver for Q# command line applications.</Description>
<PackageReleaseNotes>See: https://docs.microsoft.com/en-us/quantum/relnotes/</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/qsharp-runtime</PackageProjectUrl>
<PackageIconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</PackageIconUrl>
<PackageTags>Quantum Q# Qsharp</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 25 additions & 0 deletions src/Simulation/QCTraceSimulator.Tests/Circuits/RandomTests.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.


namespace Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.Tests {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Diagnostics;

internal function Fact(condition : Bool, message : String) : Unit {
if (not condition) {
fail message;
}
}

@Test("ResourcesEstimator")
/// # Summary
/// Checks for regression against microsoft/qsharp-runtime#256.
operation CheckRandomInCorrectRange() : Unit {
for (idxTrial in 0..99) {
let sample = Random([1.0, 2.0, 2.0]);

Fact(0 <= sample and sample <= 2, $"sample was {sample}, not in range [0, 2]");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.11.2006.2118-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.11.2006.3017-alpha">

<Import Project="..\Common\AssemblyCommon.props" />
<Import Project="..\Common\Simulators.Dev.props" />
Expand Down
33 changes: 33 additions & 0 deletions src/Simulation/QsharpCore/Arrays/Enumeration.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.Quantum.Arrays {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;

/// # Summary
/// Given an array, returns a range over the indices of that array, suitable
/// for use in a for loop.
///
/// # Type Parameters
/// ## 'TElement
/// The type of elements of the array.
///
/// # Input
/// ## array
/// An array for which a range of indices should be returned.
///
/// # Output
/// A range over all indices of the array.
///
/// # Example
/// The following `for` loops are equivalent:
/// ```Q#
/// for (idx in IndexRange(array)) { ... }
/// for (idx in IndexRange(array)) { ... }
/// ```
function IndexRange<'TElement>(array : 'TElement[]) : Range {
return 0..(Length(array) - 1);
}

}
Loading