Giter Club home page Giter Club logo

qsharp-runtime's Introduction

DEPRECATION NOTICE

This repository is deprecated.

For the Modern QDK repository, please visit Microsoft/qsharp.

You can also try out the Modern QDK in VS Code for Web at vscode.dev/quantum.

For more information about the Modern QDK and Azure Quantum, visit https://aka.ms/AQ/Documentation.

Classic QDK

This repository contains the runtime components for the Quantum Development Kit. It consists of the libraries and packages needed to create and simulate quantum applications using Q#.

  • Azure/: Source for client package to create and manage jobs in Azure Quantum.
  • Simulation/: Source for Q# simulation. Includes code generation, full-state and other simulators.
  • xUnit/: Source for the xUnit's Q# test-case discoverer.

New to Quantum?

See the introduction to quantum computing provided with the Quantum Development Kit.

Installing the Quantum Development Kit

If you're looking to use Q# to write quantum applications, please see the instructions on how to get started with using the Quantum Development Kit including the Q# compiler, language server, and development environment extensions.

Please see the installation guide for further information on how to get started using the Quantum Development Kit to develop quantum applications. You may also visit our Quantum repository, which offers a wide variety of samples on how to write quantum based programs.

Building from Source

Build Status

Note that when building from source, this repository is configured so that .NET will automatically look at the Quantum Development Kit prerelease feed in addition to any other feeds you may have configured.

All platforms

  1. Install the pre-reqs:

Windows

To build on Windows:

  1. Install the pre-reqs:

    • Install Visual Studio 2022. Make sure you install the following workloads:
      • Desktop development with C++
      • Spectre-mitigated libraries. Once Visual Studio has been installed, using the installer for the VS version of interest, click the"Modify" button, go to the "Individual Components" tab, search for "spectre", select the latest version of "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs", and click the "Modify" button to install the selected components
      • .NET 6.0 Runtime
    • Install Chocolately. This is required to download other prerequisites if not already installed, such as LLVM, CMake, Ninja, and Rust. (If these are already installed and on your PATH, then Chocolately may not be needed).
  2. Run bootstrap.ps1 from PowerShell

    • pre-req (in PowerShell): Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    • The script might install additional tools (a specific compiler, build tools, etc)
    • Then it builds release flavor of the native (C++) full-state simulator and debug flavor of the Simulation solution.
    • You only need to run it once.
  3. Open and build the Simulation.sln solution in Visual Studio.

The Simulation.sln solution does not include the full-state quantum simulator. To change it, you can open the quantum-simulator.sln solution created during bootstrap in the src\Simulation\Native\build. To integrate your changes with the rest of the simulation components, you must manually build it.

macOS/Linux

To build on other platforms:

  1. Install the pre-reqs:
    • Install .NET 6.0 (version lower than 6.0.300 is recommended)
    • Install Homebrew. This is needed to install other prerequisites such as Ninja and LLVM.
    • On WSL/Linux:
      • .NET 6.0: sudo apt install dotnet-sdk-6.0 dotnet-runtime-6.0. The possible result can be as in listing B below.
        See also other ways here or here.
      • Install libomp needed for the native (C++) full-state simulator. sudo apt install libomp-14-dev. The possible result can be as in listing A below.

Listing A.

# In an empty directory:
dpkg -l *libomp*
# Desired=Unknown/Install/Remove/Purge/Hold
# | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
# |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
# ||/ Name             Version           Architecture Description
# +++-================-=================-============-=================================
# ii  libomp-14-dev    1:14.0.0-1ubuntu1 amd64        LLVM OpenMP runtime - dev package
# un  libomp-14-doc    <none>            <none>       (no description available)
# un  libomp-dev       <none>            <none>       (no description available)
# un  libomp-x.y       <none>            <none>       (no description available)
# un  libomp-x.y-dev   <none>            <none>       (no description available)
# un  libomp5          <none>            <none>       (no description available)
# ii  libomp5-14:amd64 1:14.0.0-1ubuntu1 amd64        LLVM OpenMP runtime

Listing B.

# In an empty directory:
dpkg -l *dotnet*

# Desired=Unknown/Install/Remove/Purge/Hold
# | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
# |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
# ||/ Name                      Version      Architecture Description
# +++-=========================-============-============-=======================================
# un  dotnet                    <none>       <none>       (no description available)
# ii  dotnet-apphost-pack-6.0   6.0.5-1      amd64        Microsoft.NETCore.App.Host 6.0.5
# ii  dotnet-host               6.0.5-1      amd64        Microsoft .NET Host - 6.0.5
# ii  dotnet-hostfxr-6.0        6.0.5-1      amd64        Microsoft .NET Host FX Resolver - 6.0.5
# un  dotnet-nightly            <none>       <none>       (no description available)
# ii  dotnet-runtime-6.0        6.0.5-1      amd64        Microsoft.NETCore.App.Runtime 6.0.5
# ii  dotnet-runtime-deps-6.0   6.0.5-1      amd64        dotnet-runtime-deps-debian 6.0.5
# ii  dotnet-sdk-6.0            6.0.300-1    amd64        Microsoft .NET SDK 6.0.300
# ii  dotnet-targeting-pack-6.0 6.0.5-1      amd64        Microsoft.NETCore.App.Ref 6.0.5
  1. Run bootstrap.ps1
    • The script might install additional tools (a specific compiler, build tools, etc)
    • Then it builds release flavor of the native (C++) full-state simulator and debug flavor of the Simulation solution.
    • You only need to run it once.
  2. From the command line, run:
    • dotnet build Simulation.sln

The Simulation.sln solution does not include the full-state simulator. To integrate any changes with the rest of the simulation components, you need to manually build it using make in the src\Simulation\Native\build folder.

Testing

All unit tests are part of the Simulation.sln solution. To run the tests:

  • From Visual Studio:
    • Open Test Explorer by choosing Test > Windows > Test Explorer from the top menu bar.
    • Run your unit tests by clicking Run All.
  • From the command line, run:
    • dotnet test Simulation.sln

Feedback

If you have feedback about the Q# simulators or any other runtime component, please let us know by filing a new issue! If you have feedback about some other part of the Microsoft Quantum Development Kit, please see the contribution guide for more information.

Reporting Security Issues

For information on how to report a security issue on this repository, please review the guidance in SECURITY.md.

Legal and Licensing

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

For more details, please see CONTRIBUTING.md, or the contribution guide.

qsharp-runtime's People

Contributors

anjbur avatar anpaz avatar avasch01 avatar bamarsha avatar bettinaheim avatar billti avatar cesarzc avatar cgranade avatar codingupastorm avatar dmitryvasilevsky avatar filipw avatar george-moussa avatar idavis avatar irinayatsenko avatar israelmiles avatar kuzminrobin avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar minestarks avatar msoeken avatar ricardo-espinoza avatar scottcarda-ms avatar sonialopezbravo avatar swernli avatar tcnickolas avatar theroughcode avatar vadym-kl avatar vxfield avatar xinyi-joffre avatar yusudz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qsharp-runtime's Issues

Values of type Range are iterated over upon serialization

Describe the bug
When serializing values of type Range as returned by a function or operation, the serializer expands the Range into an array of its values:

image

This is confirmed by looking at the raw JSON saved to the notebook:

   "outputs": [
    {
     "data": {
      "application/json": "[0,1,2,3,4]",
      "text/html": [
       "<ul><li>0</li><li>1</li><li>2</li><li>3</li><li>4</li></ul>"
      ],
      "text/plain": [
       "0, 1, 2, 3, 4"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ]

This makes it impossible to directly call a function or operation that expects a Range as its input from the Python client.

Expected behavior
Range should serialize and deserialize into a JSON schema that is distinct from the JSON schema for Int[].

Notify simulators when runtime exception has occurred during Q# execution

Please describe what you would like the feature to accomplish.

It would be nice if simulators will get notified when runtime exception has occurred during Q# execution. This way, the simulator can preserve additional information about the state of the program to help debug the problem.

Describe the solution you'd like

I would like a method Fail to be added to IOperationFactory interface that should be called by an operation when an exception occurs, similar to StartOperation and EndOperation methods.
I would also like to have OnFail event in SimulatorBase class, similar to OnOperationStart, OnOperationEnd events invoked through StartOperation, EndOperation.

Describe alternatives you've considered

I am not aware of alternatives achieving the same result.

Additional context

There is a potential for state to change due to code in finally blocks in the C# generated code.
For this reason, the state of the simulator might change by the time the exception has been caught in the C# driver and this in turn makes debugging more difficult especially in absence of interactive debuggers, for example, when using from command line or IQ#.

Improve error messaging in Q# test & application projects

What you would like the feature to accomplish.

Currently when a single test fails the error message is verbose, hard to read and exposes C# code generation internals.
See below for an example. Similar improvement would be nice to have in the code that is generated when creating Q# console application.

Additional context

Consider a test project with a single qsharp file with a single test that fails:

namespace qsharp_unit_test_example {
    
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Diagnostics;
    open Microsoft.Quantum.Intrinsic;

    @Test("QuantumSimulator")
    operation AllocateQubit () : Unit {
        
        using (q = Qubit()) {
            X(q); // the new line we added to make test fail
            Assert([PauliZ], [q], Zero, "Newly allocated qubit must be in |0> state."); //test fails here
        }
        
        Message("Test passed.");
    }
}

Then run dotnet test for the project and observe the following output:

[xUnit.net 00:00:01.12]     qsharp_unit_test_example.AllocateQubit+QuantumSimulator.AllocateQubit [FAIL]
  X qsharp_unit_test_example.AllocateQubit+QuantumSimulator.AllocateQubit [52ms]
  Error Message:
   System.AggregateException : One or more errors occurred. (Newly allocated qubit must be in |0> state.
        Expected:       0
        Actual: 1)
---- Microsoft.Quantum.Simulation.Core.ExecutionFailException : Newly allocated qubit must be in |0> state.
        Expected:       0
        Actual: 1
  Stack Trace:
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at qsharp_unit_test_example.AllocateQubit.QuantumSimulator.AllocateQubit() in D:\repos\qsharp-unit-test-example\Tests.qs:line 16
----- Inner Stack Trace -----
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.QSimAssert.<get_Body>b__6_0(ValueTuple`4 _args)
   at Microsoft.Quantum.Simulation.Core.Operation`2.Apply(I a)
   at Microsoft.Quantum.Simulation.Core.Operation`2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args)
   at qsharp_unit_test_example.AllocateQubit.<get_Body>b__27_0(QVoid __in__) in D:\repos\qsharp-unit-test-example\Tests.qs:line 13
--- End of stack trace from previous location where exception was thrown ---
   at qsharp_unit_test_example.AllocateQubit.<get_Body>b__27_0(QVoid __in__) in D:\repos\qsharp-unit-test-example\Tests.qs:line 14
   at Microsoft.Quantum.Simulation.Core.Operation`2.Apply(I a)
   at Microsoft.Quantum.Simulation.Core.Operation`2.Apply[GenO](Object args)
   at Microsoft.Quantum.Simulation.Common.SimulatorBase.Execute[T,I,O](I args)
   at Microsoft.Quantum.Simulation.Common.SimulatorBase.<>c__DisplayClass39_0`3.<Run>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) 
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
  Standard Output Messages:
 Unhandled exception. Microsoft.Quantum.Simulation.Core.ExecutionFailException: Newly allocated qubit must be in |0> state.
        Expected:       0
        Actual: 1
  ---> Microsoft.Quantum.Intrinsic.Assert on :line 13
    at qsharp_unit_test_example.AllocateQubit on D:\repos\qsharp-unit-test-example\Tests.qs:line 9

Potential solution

It would be nice if currently generated C# code in Tests.g.cs

public void AllocateQubit()
#line 9 "D:/repos/qsharp-unit-test-example/Tests.qs"
{
    var sim = new Microsoft.Quantum.Simulation.Simulators.QuantumSimulator();
    if (sim is Microsoft.Quantum.Simulation.Common.SimulatorBase baseSim && this.Output != null)
    {
        baseSim.OnLog += this.Output.WriteLine;
    }

    sim.Run<AllocateQubit, QVoid, QVoid>(QVoid.Instance).Wait();
    if (sim is IDisposable disposeSim)
    {
        disposeSim.Dispose();
    }
}

looked more like:

public void AllocateQubit()
#line 9 "D:/repos/qsharp-unit-test-example/Tests.qs"
{
    var sim = new Microsoft.Quantum.Simulation.Simulators.QuantumSimulator();
    if (sim is Microsoft.Quantum.Simulation.Common.SimulatorBase baseSim && this.Output != null)
    {
        baseSim.OnLog += this.Output.WriteLine;
    }
    try
    {
        sim.Execute<AllocateQubit, QVoid, QVoid>(QVoid.Instance);
    }
    catch(Exception e) 
    {
#line 9 "D:/repos/qsharp-unit-test-example/Tests.qs"        
        Xunit.Assert.True(false,"Q# Test failed. For details see the Standard output below.");
    }
    finally
    {
        if (sim is IDisposable disposeSim)
        {
            disposeSim.Dispose();
        }
    }
}

which leads to the following output upon test failure:

[xUnit.net 00:00:01.10]     qsharp_unit_test_example2.AllocateQubit+QuantumSimulator.AllocateQubit [FAIL]

  X qsharp_unit_test_example2.AllocateQubit+QuantumSimulator.AllocateQubit [51ms]
  Error Message:
   Q# Test failed. For details see the Standard Output Messages below.
Expected: True
Actual:   False
  Stack Trace:
     at qsharp_unit_test_example2.AllocateQubit.QuantumSimulator.AllocateQubit() in D:\repos\qsharp-unit-test-example\Tests.qs:line 9
  Standard Output Messages:
 Unhandled exception. Microsoft.Quantum.Simulation.Core.ExecutionFailException: Newly allocated qubit must be in |0> state.
        Expected:       0
        Actual: 1
  ---> Microsoft.Quantum.Intrinsic.Assert on :line 13
    at qsharp_unit_test_example.AllocateQubit on D:\repos\qsharp-unit-test-example\Tests.qs:line 9

Also note that with current code QuantumSimulator is not disposed in case exception happens.

Add DumpUnitary function

Please describe what you would like the feature to accomplish.
It would be extremely helpful to be able to see a matrix representation of a Q# operation.

Describe the solution you'd like
A DumpUnitary function that would take an operation on N qubits as a parameter and dump an array of complex numbers that is a matrix representation of that unitary. It could use Choi–Jamiłkowski isomorphism to extract those coefficients from the amplitudes of a state prepared in a specific way.

Describe alternatives you've considered
My current workaround is https://github.com/microsoft/QuantumKatas/tree/master/utilities/DumpUnitary, but it is fairly fragile (it broke when DumpMachine output format broke, it doesn't account for relative phases between columns, and so on). This really seems like something that should be part of the built-in language capabilities, not something that each user has to implement for themselves.

Code generation failure when looping over array in an adjointable operation

Describe the bug

The following operation fails to compile with C# errors:

operation PrepareCatState(register : Qubit[]) : Unit is Adj + Ctl {
    H(register[0]);
    for (target in register[1...]) {
        CNOT(register[0], target);
    }
}

image

Modifying the operation to not be adjointable works, as does storing the array slice in a local variable before looping:

operation PrepareCatState(register : Qubit[]) : Unit is Adj {
    H(register[0]);
    let targets = register[1...];
    for (target in targets) {
        CNOT(register[0], target);
    }
}

Using an array function also works around the issue:

open Microsoft.Quantum.Arrays;
operation PrepareCatState(register : Qubit[]) : Unit is Adj {
    H(register[0]);
    for (target in Rest(register)) {
        CNOT(register[0], target);
    }
}

To Reproduce

See reproduction at: https://mybinder.org/v2/gist/cgranade/471654e721ff80ca8de8c80a954f6d20/master

System information

image

Distribution of T gates in a Clifford + T circuit

In order to determine the places where a circuit can be optimised, an analysis of the distribution of T gates (nr. of T parallel T gates at each time step of the circuit execution -- after the gates have been scheduled) is useful. Does the QCTraceSimulator support such a feature? If not would it be interesting to implement it?

Additional handles in generated code for debug support

Right now, auto-generated specializations do not contain any positional information. We could provide better debugging support if we pointed to the original specialization declaration (implicit or explicit) upon code gen and have properties with the full name of the callable and it's range within the Q# file.

Code gen failure when returning the value of a generic function

Describe the bug

Run-time failure related to use of type parameters and partial application

To Reproduce

Create project with Bug.qs with content below and run PrintAllPaulis() operation.

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

    operation PrintPaulies( paulis : Pauli[] ) : Unit { Message($"{paulis}"); }

    operation ApplyComposed<'U,'V>( op : ('U => Unit), fn : ('V -> 'U), arg : 'V) : Unit {
        op(fn(arg));
    }

    function ArrayFromIndicies<'T>( values : 'T[], indicies : Int[] ) : 'T[] {
        mutable arr = new 'T[Length(indicies)];
        for( i in 0 .. Length(indicies) - 1) {
            set arr w/= i <- values[indicies[i]];
        }
        return arr;
    }

    operation IterateThroughCartesianPowerT<'T> (power : Int, values : 'T[], op : ('T[] => Unit)) : Unit {
        let opInt = ApplyComposed(op, ArrayFromIndicies(values,_),_);
        IterateThroughCartesianPower(power, Length(values), opInt);
    }

    operation PrintAllPaulis() : Unit {
        IterateThroughCartesianPowerT(3, [PauliI,PauliX,PauliY,PauliZ], PrintPaulies);
    }
}

Expected behavior

64 lines of all possible combinations of 3 Pauli operators printed to console.

Actual behavior

Run-time failure with the following data:

  Message: 
    System.MissingMethodException : Constructor on type 'Microsoft.Quantum.Simulation.Core.IQArray`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.
  Stack Trace: 
    at RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at PartialMapper.CastTuple(Type targetType, Object value)
    at PartialMapper.CastTuple(Type targetType, Object value)
    at <>c__DisplayClass9_0`2.<Create>b__0(P argTuple)
    at FunctionPartial`3.<get_Body>b__16_0(P a)
    at Function`2.Apply[GenO](Object args)
    at GenericCallable.Apply[O](Object args)
    at <>c.<get_Body>b__7_0(ValueTuple`3 __in__) in Bug.qs line: 8
    at OperationPartial`3.<get_Body>b__20_0(P a)
    at Operation`2.Apply(I a)
    at Operation`2.Apply[GenO](Object args)
    at GenericCallable.Apply[O](Object args)
    at <>c.<get_Body>b__11_0(ValueTuple`2 __in__)
    at Operation`2.Apply(I a)
    at ICallable<I,O>.Apply(I args)
    at IterateThroughCartesianPower.<get_Body>b__15_0(ValueTuple`3 __in__)
    at Operation`2.Apply(I a)
    at ICallable<I,O>.Apply(I args)
    at IterateThroughCartesianPowerT`1.<get_Body>b__23_0(ValueTuple`3 __in__) in Bug.qs line: 21

System information

  • OS: Windows
  • .NET Core Version: 2.2.401

Make the trace simulator more efficient by caching statistics of pure operations

If an operation performs no measurements and generates no random numbers, its cost behavior is determined entirely by its inputs. For inputs that are qubits, only the number of qubits matters. For example, if I run an addition circuit on two registers of size n and it uses n-4 Toffoli gates and some Cliffords and that's all it ever does, then the next time I run the addition on two registers of size n it will do the exact same thing, at least in terms of the operations counts. And since all measurement results must be specified when tracing, we don't need to run that addition circuit at all. All we need to do is add its totals into our running total.

If the tracing simulator automatically noticed this kind of repetition, it could become hundreds of times more efficient. For problems with the right recursive structure, it would be trillions of times more efficient.

(I say this as I stare at the tracing simulator struggling to get past n=2^11 in a case where this optimization would easily make n=2^100 doable.)

Support for Q# unit tests

Currently, unit tests require a C# driver. The Q# compiler has recently added support for defining unit tests in Q# using the @test("TargetName") attribute. "TargetName" may either be one of the simulators provided as part of the QDK (QuantumSimulator, TraceSimulator, ToffoliSimulator), or a fully qualified name to a custom class. Supporting that feature requires generating suitable C# code such that these tests are picked up by test explorer.

Make DumpMachine output configurable in the code

Please describe what you would like the feature to accomplish.
DumpMachine is one of the key features for a person who starts learning quantum computing using Q#. Unfortunately, the little-endian labels and ordering of the basis states gets new learners confused in most of cases. IQ# tries to solve this by introducing different formats of labeling (little endian vs big endian vs bit string), but I'd really like to see a similar feature in regular Q# projects, since I do most Q# coding and debugging in VS.

Describe the solution you'd like
Add a parameter to DumpMachine that would allow user to switch between little endian, big endian and bit string formats and orderings of the basis vectors in the output.

Describe alternatives you've considered
So far I have to stick to explaining the output of DumpMachine in great detail, but it still doesn't help the learners.

Side note
Adding an extra parameter to DumpMachine is going to be a fairly painful breaking change, but it would simplify microsoft/iqsharp#126 - it would allow the user to configure the output of DumpMachine directly rather than by configurations, so that running the same code in Notebooks and in VS Code produces the same results.

Native Simulator not picking the version from build variables

Describe the bug

During the build, there are environment variables like ASSEMBLY_VERSION that should be used to identify the native simulator version, but currently it is not using that.

Expected behavior

The variables in CMakeList.txt should be populated using the build's environment variables.

Actual behavior

They have hardcoded values.

Efficient simulation of measurement-based uncomputation

One of the results in https://arxiv.org/abs/1902.02134 is a very efficient way to uncompute a table lookup (appendix C).

When attempting to implement this construction in Q#, I ran into a catch-22. If I want to be able to simulate big cases, I need to use the Toffoli simulator. But this construction is based on performing measurements in the X basis, and involves phase fixups, so the Toffoli simulator is not able to handle it.

I believe that these kinds of constructions are going to become more and more common, and so it would be beneficial to have a simulator capable of handling them efficiently. I don't know exactly what that would look like, but it seems like an approachable problem that a simulation framework will often need to handle.

Option to count Toffolis instead of counting T gates

Using current techniques, it is cheaper to perform a Toffoli gate directly via a CCZ state instead of via multiple T states. As a result, I often want to count Toffoli gates instead of T gates.

I have Q# code that counts Toffolis by instead counting Ts then dividing by 7 in order to compute the Toffoli count, but this code will break as soon as e.g. the trace simulator is updated to use the actual T count of 4 per Toffoli. I would rather more directly express my intent, so that my code will continue to work in the future.

(Also, counting Toffolis is nominally cheaper than counting Ts because fewer decomposition steps are needed.)

ToString tests fail when current locale uses comma as decimal point

Describe the bug

When the computer's current locale uses a comma for the decimal point, the "ToStringTests" in the "DebuggingToolsTests" fail because they call ToString on a tuple containing a double, which formats the double using a comma. However, the expected test output is hard-coded to expect a period. The test fails, for example, in the German (de-DE) locale.

To Reproduce

  1. Change your computer's locale to one that uses commas as decimal points
  2. Run the DebuggingToolsTests.ToStringTests test

Expected behavior

The tests should pass regardless of the current locale.

Actual behavior

Testname:	Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
FullName für Test:	Tests.Microsoft.Quantum.Simulation.Simulators.Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
Testquelle:	C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs : Zeile 23
Testergebnis:	Fehler
Testdauer:	0:00:00

Testname:	Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
Testergebnis:	Fehler
Ergebnis StackTrace:	
at Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.<>c.<ToStringTests>b__0_0(SimulatorBase qsim) in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs:line 57
   at Microsoft.Quantum.Simulation.Simulators.Tests.OperationsTestHelper.RunWithMultipleSimulators(Action`1 test) in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\OperationsTestHelper.cs:line 151
   at Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests() in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs:line 25
Ergebnis Meldung:	
Assert.Equal() Failure
                   ↓ (pos 9)
Expected: T4((3, (1.1, False, One)))
Actual:   T4((3, (1,1, False, One)))
                   ↑ (pos 9)

System information

  • OS: Windows 10

  • .NET Core Version: 3.1.101

  • IQ# Version: N/A

  • Python Version (if applicable): 3.8.2

Additional context

The Q# compiler has a similar bug in its tests: microsoft/qsharp-compiler#363

Generic function unnexpectedly returns 'QVoid' when called from another file

Describe the bug

While writing unit tests for a generic-typed function, I ran into some strange behavior. The function works perfectly when called from the same file, but it seems to return a QVoid when called from the test suite, instead of the expected Bool.

To Reproduce

  • Using Visual Studio, create a new Q# Test Project with boilerplate TestSuiteRunner.cs
  • Create a new Q# file in the same namespace containing a generic-typed function that returns a Bool
  • Write a test that calls the function and uses the result in some way.
  • Try to build the project.

Example

Target.qs:

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

    function BuggyReturn<'T> (param: 'T): Bool
    {
        return true;
    }

    function AssertBuggyReturn<'T> (param: 'T): Unit
    {
        if (not BuggyReturn<'T>(param))
        {
            fail "BuggyReturn returned false";
        }
    }
}

Tests.qs:

namespace Quantum.QSharpTestProject1
{
    open Microsoft.Quantum.Intrinsic;
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Diagnostics;


    function BuggyReturnTest () : Unit
    {
        AssertBuggyReturn<Int>(0); // This works fine!
        if (not BuggyReturn<Int>(0)) // This gives error
        {
            fail "BuggyReturn returned false";
        }
    }
}

Note that in the above example, AssertBuggyReturn builds just fine, but BuggyReturnTest does not. It gives the error, Operator '!' cannot be applied to operand of type 'QVoid'.

Expected behavior

The code in AssertBuggyReturn and BuggyReturnTest is exactly the same, and therefore should behave identically. BuggyReturn should always return a Bool and not QVoid.

System information

QDK extension version: 0.9.1909.3002

Visual Studio information:

Microsoft Visual Studio Enterprise 2019
Version 16.3.5
VisualStudio.16.Release/16.3.5+29411.108
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Enterprise

Visual C++ 2019   00433-90101-61314-AA195
Microsoft Visual C++ 2019
...

C# code generation generates invalid code when accessing UDT items named `Data`.

Describe the bug

When a UDT has a named item whose name is Data, accessing that item causes C# code generation to display a warning:

Microsoft (R) Build Engine version 16.3.0-preview-19377-01+dd8019d9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 23.26 ms for C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
obj\qsharp\src\Operations.g.cs(27,31): warning CS0108: 'Foo.Data' hides inherited member 'QTuple<IQArray<long>>.Data'. Use the new keyword if hiding was intended. [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]
  runtime-bug -> C:\Users\<redacted>\tmp\runtime-bug\bin\Debug\netcoreapp2.1\runtime-bug.dll

If the UDT contains named items other than Data as well, then the code generation step fails entirely:

Microsoft (R) Build Engine version 16.3.0-preview-19377-01+dd8019d9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 24.7 ms for C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
obj\qsharp\src\Operations.g.cs(27,31): warning CS0108: 'Foo.Data' hides inherited member 'QTuple<(IQArray<long>, string)>.Data'. Use the new keyword if hiding was intended. [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]
obj\qsharp\src\Operations.g.cs(27,44): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item1' and no accessible extension method 'Item1' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]        
obj\qsharp\src\Operations.g.cs(28,45): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]        
obj\qsharp\src\Operations.g.cs(29,45): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item1' and no accessible extension method 'Item1' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]        
obj\qsharp\src\Operations.g.cs(30,37): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]        
obj\qsharp\src\Operations.g.cs(34,26): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item1' and no accessible extension method 'Item1' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]        
obj\qsharp\src\Operations.g.cs(35,26): error CS1061: 'IQArray<long>' does not contain a 
definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'IQArray<long>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\<redacted>\tmp\runtime-bug\runtime-bug.csproj]  

In either case, when calling from IQ#, the kernel dies with no error message printed to the notebook or the console.

To Reproduce

open Microsoft.Quantum.Arrays;

newtype Foo = (Data: Int[]);

function Example() : Foo[] {
    return Mapped(Foo, [[1, 2], [3, 4, 5], new Int[0], [16]]);
}

function Boom() : Int {
    let foos = Example();
    return foos[0]::Data[0];
}

Renaming DataNotData, the example works as expected.

See https://gist.github.com/cgranade/ee913899e0b40e8ee8cd43b82632a454 for IQ# version.

System information

  • OS: Windows 10

  • .NET Core Version: 3.0.100-preview8-013656

  • IQ# Version: 0.8.1907.1701

Additional context
Add any other context about the problem here.

Enable setting breakpoints on Q# code in Visual Studio Code

Please describe what you would like the feature to accomplish.

Enable setting breakpoints on Q# code in Visual Studio Code similar to Visual Studio.

Describe the solution you'd like

The solution requires contribution to C# extension for Visual Studio Code.
Creating issue here for visibility and for making sure that a workaround is well known.

Describe alternatives you've considered

There is a known workaround that requires adding one line to package.json of C# extension.
Steps are the following:

  • Run code ~/.vscode/extensions/ms-vscode.csharp-*/package.json in Bash
  • Goto symbol enableBreakpointsFor in package.json ( type Ctrl+P @enableBreakpointsFor )
  • Add qsharp to the list of languageIds:
...
"type": "coreclr",
"label": ".NET Core",
"enableBreakpointsFor": {
	"languageIds": [
		"csharp",
		"razor",
		"qsharp",
		"aspnetcorerazor"
	]
},
...

Use accelerated SWAP kernel to implement Intrinsic.SWAP.

Please describe what you would like the feature to accomplish.
Currently, the Microsoft.Quantum.Intrinsic.SWAP operation is provided along with a pure-Q# implementation in terms of three CNOT calls:

    operation SWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit
    is Adj + Ctl {
        body (...)
        {
            CNOT(qubit1, qubit2);
            CNOT(qubit2, qubit1);
            CNOT(qubit1, qubit2);
        }
        
        adjoint self;
    }

The C++ runtime for the QuantumSimulator target machine supports, however, an accelerated kernel for applying SWAP gates. It would help with simulator performance to expose this as an implementation of the SWAP intrinsic operation, similarly to how X is exposed by QuantumSimulator.

Add Attribute to Microsoft.Quantum.Core

In order to support attributes on declarations, the compiler relies on an attribute "Attribute" being defined in the Microsoft.Quantum.Core namespace. After updating to a compiler version that handles attributes, we need to add this, and possibly also an External attribute.

Make sure that all .NET assembly files are shipped with debug symbols and XML documentation

Issue

Currently it is hard to debug issues with some parts of qsharp-runtime because not all .pdb and .xml files are included with corresponding .dll files.

How to reproduce

The contents of .nuget\packages\microsoft.quantum.simulators\0.10.2001.2831\lib\netstandard2.1
is the following:

Microsoft.Quantum.Simulation.Common.dll
Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll
Microsoft.Quantum.Simulation.Simulators.dll
Microsoft.Quantum.Simulation.Simulators.pdb
Microsoft.Quantum.Simulation.Simulators.xml

Note that for Microsoft.Quantum.Simulation.Common.dll and Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll both xml and pdb files are missing.

Decimals and negative values as Result type when calling Q# op

See attached files. The Python call accepts 0 and 1 as input qubit result types (putting them as Result.Zero and Result.One in Q#), but also accepts decimals and negative numbers without throwing an error. It appears that it rounds to whichever is closer, 0 or 1. So, when the argument is anything >0.5, it goes to Result.One, and anything =<0.5 is put to Result.Zero.

Side note: wildcard imports from the Q# namespace do not work, but also don't throw an error noting that

bugtest.zip

Make printing stack trace optional and configurable

** Please describe what you would like the feature to accomplish.**
I'm updating the Quantum Katas to QDK version 0.10.2002.2610, and it looks like the cell output in case of an error became a lot bulkier. As of PR #79, they include a mandatory Q# stack trace, which (for the use case of the Katas) doesn't really help the user figure out their issue, and might scare them away instead (this was the feedback we got when we had long stack trace in new Python tutorials).

image

I considered turning off the test output, but that won't work, since the katas rely on the output of Message and DumpMachine for conveying useful information about the test outcomes (such as the first line of task 1.1) and for allowing the user to debug their solution.

Ideally we would have an option to turn off the extra stack tracing, and then use that option in the TestTarget method of TestSuiteRunner in the katas.

Test setup

Currently, it is possible that adding a Q# unit test that causes a particular issue results in a test run being aborted rather than failing (which is a lot harder to notice). The culprits are the Debug.Asserts - it would be nice if we could find a better setup for the error handling/logging in these cases, that makes test failures obvious.

The active test run was aborted. Reason: Test host process crashed : Process terminated. Assertion failed.
at Microsoft.Quantum.Simulation.Core.PartialMapper.Create[P,I](Object partial)
at Microsoft.Quantum.Simulation.Core.FunctionPartial3..ctor(Function2 op, Object partialTuple)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.Quantum.Simulation.Core.GenericPartial.CreateCallable(Type P, Type O)
at Microsoft.Quantum.Simulation.Core.GenericCallable.FindCallable(Type I, Type O)
at Microsoft.Quantum.Simulation.Core.GenericCallable.Apply[O](Object args)
at Microsoft.Quantum.Simulation.Core.GenericCallable.Microsoft.Quantum.Simulation.Core.ICallable.Apply[O](Object args)
at Issue48.ApplyComposed2.<>c.<get_Body>b__7_0(ValueTuple3 in) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\Circuits\Issue48.qs:line 51
at Microsoft.Quantum.Simulation.Core.OperationPartial3.<get_Body>b__20_0(P a) at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Apply[GenO](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Apply[O](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Microsoft.Quantum.Simulation.Core.ICallable.Apply(Object args) at Issue48.IterateThroughCartesianProduct.<>c.<get_Body>b__11_0(ValueTuple2 in) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\Circuits\Issue48.qs:line 18
at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a) at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args)
at Issue48.IterateThroughCartesianPower.<get_Body>b__15_0(ValueTuple3 __in__) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\Circuits\Issue48.qs:line 44 at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args) at Issue48.IterateThroughCartesianPowerT1.<get_Body>b__23_0(ValueTuple3 __in__) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\Circuits\Issue48.qs:line 64 at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Apply[GenO](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Apply[O](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Microsoft.Quantum.Simulation.Core.ICallable.Apply(Object args) at Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.PrintAllPaulisTest.<get_Body>b__14_0(QVoid __in__) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\Circuits\Issue48.qs:line 78 at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args) at Microsoft.Quantum.Simulation.XUnit.TestOperation.<get_TestOperationRunner>b__6_0(IOperationFactory sim) at Microsoft.Quantum.Simulation.Simulators.Tests.QuantumSimulatorTests.QSimTestTarget(TestOperation op) in C:\Users\beheim\Source\Repos\QsSimulation\src\Simulation\Simulators.Tests\QuantumSimulatorTests\CircuitsTests.cs:line 23 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Xunit.Sdk.TestInvoker1.CallTestMethod(Object testClassInstance) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 150
at Xunit.Sdk.TestInvoker1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 257 at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Xunit.Sdk.TestInvoker1.<>c__DisplayClass48_1.b__1()
at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48 at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func1 asyncAction)
at Xunit.Sdk.TestInvoker1.<>c__DisplayClass48_1.<InvokeTestMethodAsync>b__0() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 242 at Xunit.Sdk.ExceptionAggregator.RunAsync(Func1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func1 code) at Xunit.Sdk.TestInvoker1.InvokeTestMethodAsync(Object testClassInstance) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 241
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.TestInvoker1.InvokeTestMethodAsync(Object testClassInstance) at Xunit.Sdk.TestInvoker1.b__47_0() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 206
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.TestInvoker1.<RunAsync>b__47_0() at Xunit.Sdk.ExceptionAggregator.RunAsync[T](Func1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 107
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.ExceptionAggregator.RunAsync[T](Func1 code) at Xunit.Sdk.TestInvoker1.RunAsync() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 189
at Xunit.Sdk.XunitTestRunner.InvokeTestMethodAsync(ExceptionAggregator aggregator) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\XunitTestRunner.cs:line 84
at Xunit.Sdk.XunitTestRunner.InvokeTestAsync(ExceptionAggregator aggregator) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\XunitTestRunner.cs:line 67
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.XunitTestRunner.InvokeTestAsync(ExceptionAggregator aggregator)
at Xunit.Sdk.TestRunner1.<>c__DisplayClass43_0.<RunAsync>b__0() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestRunner.cs:line 149 at Xunit.Sdk.ExceptionAggregator.RunAsync[T](Func1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 107
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.ExceptionAggregator.RunAsync[T](Func1 code) at Xunit.Sdk.TestRunner1.RunAsync() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestRunner.cs:line 149
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Xunit.Sdk.TestRunner1.RunAsync() at Xunit.Sdk.XunitTestCaseRunner.RunTestAsync() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\XunitTestCaseRunner.cs:line 139 at Xunit.Sdk.TestCaseRunner1.RunAsync() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Run

Chaining w/ on UDTs with large numbers of named items causes stack overflow

Describe the bug

When chaining the w/ operator several times on UDTs with large numbers of named items (on my machine, this first happens on UDTs with 8 items), an uncatchable stack overflow exception results.

To Reproduce

newtype OverflowType = (
    A: String,
    B: String,
    C: String,
    D: String,
    E: String,
    F: String,
    G: String,
    H: String,
    I: String,
    J: String
);

function OverflowCase() : OverflowType {
    return Default<OverflowType>()
        w/ A <- "a"
        w/ B <- "b"
        w/ C <- "c"
        w/ D <- "d"
        w/ E <- "e";
        
}

Expected behavior

A UDT value correctly initialized with the given named items.

Actual behavior

image

System information

  • OS: Windows 10

image

Error when calling CsharpGeneration.App with no references

Describe the bug

Calling the CsharpGeneration.App with no references causes an exception, and the code can't be compiled even if it needs no references.

To Reproduce

  1. Clone the repo
  2. From the command line change to src\Simulation\CsharpGeneration.App
  3. Run dotnet run -- -i ..\Intrinsic\Math\Math.qs -o ..

Expected behavior

The codegen for Math.qs should be generated in the .. folder.

Actual behavior


Unhandled Exception: System.ArgumentException: Object of type 'System.Object[]' cannot be converted to type 'System.Collections.Generic.IEnumerable`1[System.String]'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at CommandLine.Core.InstanceBuilder.BuildImmutable[T](Type typeInfo, Maybe`1 factory, IEnumerable`1 specProps, IEnumerable`1 specPropsWithValue, List`1 setPropertyErrors)
   at CommandLine.Core.InstanceBuilder.<>c__DisplayClass0_0`1.<Build>b__5()
   at CommandLine.Parser.ParseArguments[T](IEnumerable`1 args)
   at Microsoft.Quantum.QsCompiler.CsharpGeneration.Program.main(String[] args) in C:\Repos\Solid\submodules\qsharp-runtime\src\Simulation\CsharpGeneration.App\Program.fs:line 64

System information

  • OS: Windows
  • .NET Core Version: 2.2.103
  • IQ# Version: n/a
  • Python Version: n/a

Calling an internal type constructor in a public operation generates invalid C#

Describe the bug

Calling an internal type constructor in a public operation generates a C# class for the operation that uses the internal type as the type of a protected field, which is not legal.

To Reproduce

internal newtype MyInt = Int;

operation HelloQ() : Unit {
    let x = MyInt(3);
}

Expected behavior

The generated C# code should compile.

Actual behavior

obj\qsharp\src\Program.g.cs(49,43): error CS0053: Inconsistent access: Property type "ICallable<long, MyInt>" is less accessible than property "HelloQ.MyInt". [C:\Users\samarsha\Desktop\QsSandbox\QsSandbox.csproj]

System information

  • OS: Windows
  • .NET Core 3.1.200
  • Q# SDK 0.11.2003.2505-beta

Additional context
The problem property is:

public partial class HelloQ : Operation<QVoid, QVoid>, ICallable
{
    // ...

    protected ICallable<Int64, MyInt> MyInt
    {
        get;
        set;
    }

    // ...
}

Code generation failure when mapping Q# namespaces to C# namespaces

Describe the bug

Consider two files A.B.qs and B.qs with namespaces A.B and B and operation Foo defined in B.qs. Fully qualified call B.Foo() in A.B.qs is valid Q# code that leads to invalid C# code,
because in C# B.Foo() is equivalent to A.B.Foo() in this case.

To Reproduce

First file:

namespace Buggy {

    operation Foo() : Unit is Adj {
    }
}

Second file:

namespace BuggyBuggy.Buggy {

    operation Foo2 () : Unit {
        Buggy.Foo();
    }   
}

Expected behavior

Successful compilation of Q# program.

Actual behavior

C# compilation error

 error CS0234: The type or namespace name 'Foo' does not exist in the namespace 'BuggyBuggy.Buggy' (are you missing an assembly reference?)

System information

  • OS: Windows

Additional context
Not critical, the simple workaround is to avoid the situation by naming namespaces differently.

Constructor on type not found

Describe the bug
Constructing a function (Int -> 'T) for a parameterized type 'T and passing it to another operation causes an issue when the function is called.

To Reproduce
Steps to reproduce the behavior:

Call ConstructFailure() in the following code:

open Microsoft.Quantum.Arrays();
    operation ConstructFailure() : Unit {
    	let table = [1,2,3,4];
    	TableFailure(table);
    }

    operation TableFailure<'T>(table : 'T[]) : Unit {
    	let lFunction = LookupFunction(table);
    	let x = lFunction(0);
    	Message("Has not failed");
    	LookupFailure(LookupFunction(table));
    }

    operation LookupFailure<'T> (lookup : (Int -> 'T)) : Unit {
    	let x =  lookup(0);
    	Message("Still has not failed");
    }

Expected behavior
lookup should be callable from within LookupFailure. Instead, it does not reach the second Message line before giving the error:

Unhandled Exception: System.AggregateException: One or more errors occurred. (Constructor on type 'Microsoft.Quantum.Simulation.Core.IQArray1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.) ---> System.MissingMethodException: Constructor on type 'Microsoft.Quantum.Simulation.Core.IQArray1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at Microsoft.Quantum.Simulation.Core.PartialMapper.CastTuple(Type targetType, Object value)
at Microsoft.Quantum.Simulation.Core.PartialMapper.CastTuple(Type targetType, Object value)
at Microsoft.Quantum.Simulation.Core.PartialMapper.<>c__DisplayClass9_02.<Create>b__0(P argTuple) at Microsoft.Quantum.Simulation.Core.FunctionPartial3.<get_Body>b__16_0(P a)
at Microsoft.Quantum.Simulation.Core.Function2.Apply[GenO](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Apply[O](Object args) at Microsoft.Quantum.Crypto.Canon.LookupFailure1.<get_Body>b__10_0(ICallable in)

Screenshots
If applicable, add screenshots to help explain your problem.

System information

  • Q# version 0.9.1908.2906
  • dotnet 2.1

Provide Q# call stack information with source locations in case Q# program fails

Please describe what you would like the feature to accomplish.

Currently it is hard to interpret C# call-stack to recover corresponding Q# call stack.
It would be nice no see method EnableCallStackTracking() added to SimulatorBase class and
CallStack property. The method would enable tracking of the call-stack and the property will give access to the Q# call stack at the point when the first failure in Q# program has happened.

Describe the solution you'd like

Proposed solution should use combination of OnOperationStart, OnOperationEnd and OnFail events, #68 and C# call stack information to reconstruct Q# call-stack together with corresponding source locations.

Additional context

This will be very helpful for IQ# error handling and error reporting.
This uses on #58.

C# code generation generates invalid properties for UDTs with tuple-valued named items

Describe the bug

When defining a UDT with a named item whose type is a non-singleton tuple, the C# code generation step produces invalid properties that then fail to compile when running dotnet build.

To Reproduce

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

    newtype GeneratorIndex = (IndexData: (Int[], Double[]), Subsystems: Int[]);

    function Example() : GeneratorIndex[] {
        return Mapped(
            GeneratorIndex(_, [0, 1, 2]),
            [
                ([0], [0.0]),
                ([1, 1], [1.1, 1.1]),
                ([2, 2, 2], [2.2, 2.2, 2.2])
            ]
        );
    }

    function Boom() : Int {
        let foos = Example();
        Message($"{foos}");
        return (Fst(foos[0]::IndexData))[0];
    }
}

Expected behavior

Boom should return 0.

Actual behavior

obj\qsharp\src\Operations.g.cs(27,62): error CS0029: Cannot implicitly convert type 'Microsoft.Quantum.Simulation.Core.IQArray<long>' to '(Microsoft.Quantum.Simulation.Core.IQArray<long>, Microsoft.Quantum.Simulation.Core.IQArray<double>)' [C:\Users\chgranad.REDMOND\tmp\runtime-bug\runtime-bug.csproj]
obj\qsharp\src\Operations.g.cs(28,45): error CS0266: Cannot implicitly convert typ  'Microsoft.Quantum.Simulation.Core.IQArray<double>' to 'Microsoft.Quantum.Simulation.Core.IQArray<long>'. An explicit conversion exists (are you missing a cast?) [C:\Users\chgranad.REDMOND\tmp\runtime-bug\runtime-bug.csproj]

The generated code referred to by the above error:

public (IQArray<Int64>,IQArray<Double>) IndexData => Data.Item1.Item1;
public IQArray<Int64> Subsystems => Data.Item1.Item2;
public (IQArray<Int64>,IQArray<Double>) Item1 => Data.Item1;
public IQArray<Int64> Item2 => Data.Item2;

System information

  • OS: Windows 10

  • .NET Core Version: 3.0.100-preview8-013656

  <ItemGroup>
    <PackageReference Include="Microsoft.Quantum.Standard" Version="0.8.1907.2504" />
    <PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.2504" />
  </ItemGroup>

C# code generation fails for UDTs with named items called `Item*`.

Describe the bug

I will readily admit that no one should ever write this code, but if one defines a UDT with named items such as Item1 and Item2, compiling the generated C# code fails. In particular, compilation fails even if the affected UDT is never actually used.

To Reproduce

newtype Evil = (
    Item2: Int,
    Item1: String
);

image

Cannot install IQ# on ARM due to failure to build ARM version of Microsoft.Quantum.Simulator.Runtime

Describe the bug
Can not install the library.

System information

  • OS: Raspbian
  • .Net Core version 3

Additional context
Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/home/pi/.dotnet/tools/.store/microsoft.quantum.iqsharp/0.10.1911.1607/microsoft.quantum.iqsharp/0.10.1911.1607/tools/netcoreapp3.0/any/Microsoft.Quantum.IQSharp.dll'. An attempt was made to load a program with an incorrect format.

File name: '/home/pi/.dotnet/tools/.store/microsoft.quantum.iqsharp/0.10.1911.1607/microsoft.quantum.iqsharp/0.10.1911.1607/tools/netcoreapp3.0/any/Microsoft.Quantum.IQSharp.dll'

Improve runtime exception handling

Please describe what you would like the feature to accomplish.

Currently, when fail statement is used in Q# only Q# entry-point is shown in .NET call-stack.
This is caused by the way how try,catch and finally are used in the generated C# code.
The exception is rethrown by using throw keyword which cuts off the call stack .

Describe the solution you'd like

The call stack cut-off during rethrowing of the exception is a known issue and the solutions is also known. It would be nice to incorporate the solution into the the runtime.

Describe alternatives you've considered

I am not aware of any alternatives to recover full call stack from the point where exception was actually thrown from.

Additional context

This makes it very hard to debug Q# code that relies on library functions such as Microsoft.Quantum.Diagnostics.Fact. This negatively affects debugging experience across Visual Studio, Visual Studio Code, IQ# and command line.

For example, try creating Q# application with the following code:

namespace stackTrace
{
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;
    open Microsoft.Quantum.Diagnostics;

    operation U( q : Qubit ) : Unit is Adj {
        Fact(false,"Always fails");
    } 

    operation HelloQ () : Unit {
        using ( q = Qubit() ) {
            ApplyWith(H,U,q);
        }
        
    }
}

with the following driver:

using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

namespace stackTrace
{
    class Driver
    {
        static void Main(string[] args)
        {
            using (var qsim = new QuantumSimulator())
            {
                HelloQ inst = qsim.Get<HelloQ>(typeof(HelloQ));
                inst.Apply(QVoid.Instance);
            }
        }
    }
}

and try to run it with dotnet run. The error you see is:

Unhandled Exception: Microsoft.Quantum.Simulation.Core.ExecutionFailException: Always fails
   at stackTrace.HelloQ.<get_Body>b__26_0(QVoid __in__) in  Operations.qs:line 15
   at Microsoft.Quantum.Simulation.Core.Operation`2.Apply(I a)
   at stackTrace.Driver.Main(String[] args) in \Driver.cs:line 16

Ability to generate a quantum circuit from a Q# opertaion.

Please describe what you would like the feature to accomplish.
It would be great to be able to generate the quantum circuit diagram from a Q# operation.

Describe the solution you'd like
From the command line, provide the name of a Q# operation (define in a .qs file in the local folder) and generate a file that can be used to generate a the circuit diagram in ascii, png, pdf, or some other graphical format.

Extra points if this is integrated into IQ# so we can see the circuit inside a Jupyter Notebook.

Additional context
LiQUid used to be able to do this by generating the circuit into LaTeX. Another possibility is to generate this into qpic format.

AccessViolationException after updating to .NET Core 3.1.100 Sdk

Describe the bug

When using the latest version of the .NET Core Sdk (3.1.100), the Borrow test in Microsoft.Quantum.Simulation.Simulators under CoreTests starts to not execute silently. The reason is a AccessViolationException. See the attached log from the build.

To Reproduce

Download and install the latest .NET Core Sdk from here: https://dotnet.microsoft.com/download.
Try to run the Borrowing test.

Expected behavior

The test executes as it has with .NET Core Sdk 3.0.100.

Actual behavior

The test host process crashes due to a System.AccessViolationException (see attached log).

System information

  • OS: Windows (not sure if the same problem exists on Mac/Linux)
  • .NET Core Version: 3.1.100

For more details, see Test log

std::bad_alloc exception running Q# code from Python

Describe the bug

This is a bug report. I’m calling a toy Q# example repeatedly using the python wrappers, which results in an exception.
The source code that triggers the issue on my workstation is the following:
/*********** bug.qs */
namespace Microsoft.Bug
{
open Microsoft.Quantum.Intrinsic;
// open Microsoft.Quantum.Canon;
operation Set (desired: Result, q1: Qubit) : Unit {
if (desired != M(q1)) {
X(q1);
}
}
operation main() : Unit
{
using ((a, b, c) = (Qubit8, Qubit8, Qubit8))
{
}
}
}
/ end of bug.qs /
/
bug.py */
import qsharp
from Microsoft.Bug import main
for _ in range(256):
main.simulate()
print(_)
/ end of bug.py /
Calling python3 bug.py results in the following (abridged) output:
/
output ****/
1
2

40
41
terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc
/
end of output ********/
Python then stops producing output. Removing the definition of Set (desired: Result, q1: Qubit) : Unit
from bug.qs results in python slowing down as the 42th iteration approaches, and then hanging (without
exception as far as I could see).
My machine is a Virtualbox 6.0.8 VM. My dotnet info is as follows:
$ dotnet iqsharp —version
Language kernel: 0.6.1905.301
Jupyter core: 1.1.13141.0
$ dotnet —info
.NET Core SDK (reflecting any global.json):
Version: 2.2.300
Commit: 73efd5bd87
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.2.300/
Host (useful for support):
Version: 2.2.5
Commit: 0a3c9209c0
.NET Core SDKs installed:
2.2.300 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I’m happy to run further tests if needed.
Cheers
Fernando

Additional context
Transferred over from User Voice

Enable SourceLink

Please describe what you would like the feature to accomplish.

I would like to see source code and debug symbol information when debugging code that uses NuGet packages from this repository.

Describe the solution you'd like

It would be nice to enable SourceLink support.

Describe alternatives you've considered

I am not aware of alternatives to SourceLink that are cross-platform.

C# Code generation failure when using explicitly specified generic parameter that is user defined type.

Describe the bug

C# Code generation failure when using explicitly specified generic parameter that is user defined type.

To Reproduce

namespace Buggy {
 function DefaultT<'T>() : 'T {
   mutable arr = new 'T[1];
   return arr[0];
 }
 operation DefaultComplex() : Microsoft.Quantum.Math.Complex {
   let res = DefaultT<Microsoft.Quantum.Math.Complex>();
   return res;
 } 
}

Expected behavior

Code compiles successfully.

Actual behavior

C# compiler fails with the following errors:

Bug.qs(10,20): error CS0029: Cannot implicitly convert type 
'Microsoft.Quantum.Simulation.Core.QVoid' to
'Microsoft.Quantum.Math.Complex' [...]
Bug.qs(10,20): error CS1662: Cannot convert lambda expression to intended delegate
type because some of the return types in the block are
not implicitly convertible to the delegate return type [...]

System information

  • OS: Windows

  • .NET Core Version: 2.2

Memory leak in QuantumSimulator

Describe the bug

Apparently QuantumSimulator does not release upon its destruction the memory reserved for wavefunction storage. This is not noticeable in programs that exit immediately after destroying their single simulator object. However, when the simulator is repeatedly created and deleted, the leak is very noticeable. (As mentioned in #35 creating a new simulator is currently the only way to reset the global phase.)

To Reproduce

Here's a minimal working example:

Driver.cs:

using System;

using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

namespace Bell
{
    class Driver
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 100; ++i)
            {
                using (var qsim = new QuantumSimulator())
                {
                    HelloQ.Run(qsim).Wait();
                }
                
                System.Console.WriteLine($"{i}: Press any key to continue...");
                System.Console.ReadKey();
            }
        }
    }
}

Operations.qs:

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

    operation HelloQ () : Unit {
        using (register = Qubit[26]) {
        }
    }
}

Actual behavior

Start the program and a process viewer (e.g. Task Manager on Windows), observe memory usage of the process increasing by ~1 GB on every key press. At some point, when the process has grown to >50 GB on my system, the following exception is raised:

 Unhandled exception. System.AggregateException: One or more errors occurred. (External component has thrown an exception.)
 ---> System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.QSimQubitManager.AllocateOne(UInt32 id, UInt32 qubit_id)    at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.QSimQubitManager.AllocateOneQubit(Boolean usedOnlyForBorrowing)
   at Microsoft.Quantum.Simulation.Common.QubitManager.Allocate(Int64 numToAllocate)
   at Bell.HelloQ.<get_Body>b__14_0(QVoid __in__) in C:\Users\jagukelb\repos\qapps\tmp\Bell\Operations.qs:line 7           at Microsoft.Quantum.Simulation.Core.Operation`2.Apply(I a)
   at Microsoft.Quantum.Simulation.Core.Operation`2.Apply[GenO](Object args)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Bell.Driver.Main(String[] args) in C:\Users\jagukelb\repos\qapps\tmp\Bell\Driver.cs:line 16

I assume that is the C++ backend failing to allocate memory.

Expected behavior

All memory related to the quantum simulation should be released at the exit from the QuantumSimulator object's using block.

System information

  • Windows 10
  • .NET Core Version: 3.0.100
  • QDK versions: at least 0.9 and 0.10 exhibit the bug, earlier not tested

Reset global phase of the full state simulator

ResetAll on all qubits and/or deallocating all qubits should reset the global phase of the full state simulator.

The global phase of the wavefunction is arbitrary and has no effect on measurements. However, it is reflected in the DumpMachine and DumpRegister outputs. Currently, the simulator retains a nontrivial phase even when the user goes through a sequence that should reset it to a clean state, such as deallocating all qubits. This leads to the confusing behavior that the same gate sequence applied to supposedly identical initial states (created, e.g., by releasing and allocating all qubits or applying ResetAll to all qubits) leads to different machine states, as observed through the dumps. It also makes the process of checking dumps against reference states for debugging purposes more involved than needed.

An alternative would be to have the dump functions normalize the global phase in a consistent and reproducible way. However, this would not cover some debugging scenarios where one would like the phase between different state dumps to be consistent. (E.g.: Apply the same gate sequence to the computational basis states in order to reconstruct the full unitary matrix implemented by the computation.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.