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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Simulation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulatio
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Common", "src\Simulation\Common\Microsoft.Quantum.Simulation.Common.csproj", "{8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulation.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator.Tests\Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{DD50D2D9-2765-449B-8C4B-835A428E160D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulation.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}"
EndProject
Expand All @@ -47,9 +47,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProject
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntryPointDriver", "src\Simulation\EntryPointDriver\EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Tests.Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.Microsoft.Quantum.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library1", "src\Simulation\Simulators.Tests\TestProjects\Library1\Library1.csproj", "{7256B986-6705-42FC-9F57-485D72D9DE51}"
EndProject
Expand Down
6 changes: 4 additions & 2 deletions build/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"Microsoft.Azure.Quantum.Client",
"Microsoft.Quantum.CsharpGeneration",
"Microsoft.Quantum.Development.Kit",
"Microsoft.Quantum.EntryPointDriver",
"Microsoft.Quantum.QSharp.Core",
"Microsoft.Quantum.Runtime.Core",
"Microsoft.Quantum.Simulators",
Expand All @@ -19,10 +20,11 @@
".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.CsharpGeneration.App.dll",
".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.RoslynWrapper.dll",
".\src\simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll",
".\src\simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll",
".\src\simulation\QsharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Simulators.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll",
".\src\Xunit\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Xunit.dll"
) | ForEach-Object { Get-Item (Join-Path $PSScriptRoot (Join-Path ".." $_)) };
} | Write-Output;
} | Write-Output;
4 changes: 3 additions & 1 deletion build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ function Pack-Dotnet() {
-c $Env:BUILD_CONFIGURATION `
-v detailed `
@args `
/property:Version=$Env:NUGET_VERSION `
/property:Version=$Env:ASSEMBLY_VERSION `
/property:PackageVersion=$Env:NUGET_VERSION `
$option1 `
$option2 `
$option3
Expand All @@ -61,6 +62,7 @@ function Pack-Dotnet() {
Write-Host "##[info]Using nuget to create packages"
Pack-Dotnet '../src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj'
Pack-One '../src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj' '-IncludeReferencedProjects'
Pack-Dotnet '../src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj'
Pack-Dotnet '../src/Simulation/Core/Microsoft.Quantum.Runtime.Core.csproj'
Pack-Dotnet '../src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj'
Pack-One '../src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec'
Expand Down
2 changes: 1 addition & 1 deletion src/Simulation/Common/Simulators.Dev.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<ProjectReference Include="$(EnlistmentRoot)src\Simulation\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
<ProjectReference Include="$(EnlistmentRoot)src\Simulation\Common\Microsoft.Quantum.Simulation.Common.csproj" IncludeInSimulatorPackage="true" />
<ProjectReference Include="$(EnlistmentRoot)src\Simulation\QCTraceSimulator\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj" IncludeInSimulatorPackage="true" />
<ProjectReference Include="$(EnlistmentRoot)src\Simulation\Simulators\Microsoft.Quantum.Simulation.Simulators.csproj" Condition=" '$([MSBuild]::NormalizePath($(EnlistmentRoot)src\Simulation\Simulators))' != '$(MSBuildProjectDirectory)'" IncludeInSimulatorPackage="true" />
<ProjectReference Include="$(EnlistmentRoot)src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj" Condition=" '$([MSBuild]::NormalizePath($(EnlistmentRoot)src\Simulation\Simulators))' != '$(MSBuildProjectDirectory)'" IncludeInSimulatorPackage="true" />
</ItemGroup>

<Target Name="BeforeCsharpCompile">
Expand Down
2 changes: 1 addition & 1 deletion src/Simulation/Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
using System.Runtime.InteropServices;

// Allow the test assembly to use our internal methods
[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulation.Simulators" + SigningConstants.PUBLIC_KEY)]
[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulators" + SigningConstants.PUBLIC_KEY)]
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<ProjectReference Include="..\Core\Microsoft.Quantum.Runtime.Core.csproj" />
<ProjectReference Include="..\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj" />
<ProjectReference Include="..\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
<ProjectReference Include="..\Simulators\Microsoft.Quantum.Simulation.Simulators.csproj" />
<ProjectReference Include="..\Simulators\Microsoft.Quantum.Simulators.csproj" />
</ItemGroup>

</Project>
26 changes: 22 additions & 4 deletions src/Simulation/CsharpGeneration/EntryPoint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,25 @@ type private Parameter =
let entryPointClassName = "__QsEntryPoint__"

/// The namespace containing the non-generated parts of the entry point driver.
let private driverNamespace = "Microsoft.Quantum.CsharpGeneration.EntryPointDriver"
let private driverNamespace = "Microsoft.Quantum.EntryPointDriver"

/// The driver settings object.
let private driverSettings =
let newDriverSettings = driverNamespace + ".DriverSettings" |> ``type`` |> SyntaxFactory.ObjectCreationExpression
let namedArg (name : string) expr = SyntaxFactory.NameColon name |> (SyntaxFactory.Argument expr).WithNameColon
let immutableList elements = invoke (ident "System.Collections.Immutable.ImmutableList.Create") ``(`` elements ``)``
let simulatorOptionAliases =
[ literal <| "--" + fst CommandLineArguments.SimulatorOption
literal <| "-" + snd CommandLineArguments.SimulatorOption ]
|> immutableList
[ namedArg "simulatorOptionAliases" simulatorOptionAliases
namedArg "quantumSimulatorName" <| literal AssemblyConstants.QuantumSimulator
namedArg "toffoliSimulatorName" <| literal AssemblyConstants.ToffoliSimulator
namedArg "resourcesEstimatorName" <| literal AssemblyConstants.ResourcesEstimator ]
|> SyntaxFactory.SeparatedList
|> SyntaxFactory.ArgumentList
|> newDriverSettings.WithArgumentList
:> ExpressionSyntax

/// A sequence of all of the named parameters in the argument tuple and their respective C# and Q# types.
let rec private parameters context doc = function
Expand Down Expand Up @@ -104,7 +122,7 @@ let private mainMethod context entryPoint =
let callableName, argTypeName, returnTypeName = callableTypeNames context entryPoint
let driverType = generic (driverNamespace + ".Driver") ``<<`` [callableName; argTypeName; returnTypeName] ``>>``
let entryPointInstance = ``new`` (``type`` entryPointClassName) ``(`` [] ``)``
let driver = ``new`` driverType ``(`` [entryPointInstance] ``)``
let driver = ``new`` driverType ``(`` [driverSettings; entryPointInstance] ``)``
let commandLineArgsName = "args"
arrow_method "System.Threading.Tasks.Task<int>" "Main" ``<<`` [] ``>>``
``(`` [param commandLineArgsName ``of`` (``type`` "string[]")] ``)``
Expand All @@ -121,15 +139,15 @@ let private entryPointClass context entryPoint =
context.assemblyConstants.TryGetValue AssemblyConstants.DefaultSimulator
|> snd
|> (fun value -> if String.IsNullOrWhiteSpace value then AssemblyConstants.QuantumSimulator else value)
let defaultSimulatorProperty = property "DefaultSimulator" "string" (literal defaultSimulator)
let defaultSimulatorNameProperty = property "DefaultSimulatorName" "string" (literal defaultSimulator)
let infoProperty =
property "Info"
(sprintf "EntryPointInfo<%s, %s>" argTypeName returnTypeName)
(ident callableName <|.|> ident "Info")
let members : MemberDeclarationSyntax list = [
summaryProperty
parameterOptionsProperty parameters
defaultSimulatorProperty
defaultSimulatorNameProperty
infoProperty
customSimulatorFactory defaultSimulator
createArgument context entryPoint
Expand Down
7 changes: 0 additions & 7 deletions src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ function Add-PackageReferenceDependencies($ProjectFileName) {

# Add dependencies for the projects included in this NuGet package.
Add-PackageReferenceDependencies 'Microsoft.Quantum.CsharpGeneration.fsproj'
Add-PackageReferenceDependencies '..\EntryPointDriver\EntryPointDriver.csproj'

# Manually add EntryPointDriver's project references as package references to avoid a build-time dependency cycle.
# $version$ is replaced with the current package version when the package is built.
Add-Dependency 'Microsoft.Quantum.Runtime.Core' '$version$'
Add-Dependency 'Microsoft.Quantum.Simulators' '$version$'
Add-Dependency 'Microsoft.Azure.Quantum.Client' '$version$'

$nuspec.package.metadata.AppendChild($dependencies)
$nuspec.Save([Path]::Combine((Get-Location), $target))
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,5 @@
<files>
<file src="bin\$Configuration$\**\Microsoft.Quantum.*.pdb" target="lib" />
<file src="bin\$Configuration$\**\Microsoft.Quantum.*.xml" target="lib" />

<file src="..\EntryPointDriver\bin\$Configuration$\**\Microsoft.Quantum.CsharpGeneration.EntryPointDriver.dll"
target="lib" />
<file src="..\EntryPointDriver\bin\$Configuration$\**\Microsoft.Quantum.CsharpGeneration.EntryPointDriver.pdb"
target="lib" />
<file src="..\EntryPointDriver\bin\$Configuration$\**\Microsoft.Quantum.CsharpGeneration.EntryPointDriver.xml"
target="lib" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<RootNamespace>Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests</RootNamespace>
<RootNamespace>Microsoft.Quantum.EntryPointDriver.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,7 +29,7 @@

<ItemGroup>
<ProjectReference Include="..\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj" />
<ProjectReference Include="..\EntryPointDriver\EntryPointDriver.csproj" />
<ProjectReference Include="..\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions src/Simulation/EntryPointDriver.Tests/Tests.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

module Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests
module Microsoft.Quantum.EntryPointDriver.Tests

open System
open System.Collections.Immutable
Expand Down Expand Up @@ -33,7 +33,7 @@ let private intrinsicFile = Path.GetFullPath "Intrinsic.qs"
let private testFile = Path.GetFullPath "Tests.qs"

/// The namespace used for the test cases.
let private testNamespace = "Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests"
let private testNamespace = "Microsoft.Quantum.EntryPointDriver.Tests"

/// The test case for the given test number.
let private testCase =
Expand Down Expand Up @@ -95,12 +95,12 @@ let private compileCsharp (sources : string seq) =
"System.Runtime"
"System.Runtime.Extensions"
"System.Runtime.Numerics"
"Microsoft.Quantum.CsharpGeneration.EntryPointDriver"
"Microsoft.Quantum.EntryPointDriver"
"Microsoft.Quantum.QSharp.Core"
"Microsoft.Quantum.QsDataStructures"
"Microsoft.Quantum.Runtime.Core"
"Microsoft.Quantum.Simulation.Common"
"Microsoft.Quantum.Simulation.Simulators"
"Microsoft.Quantum.Simulators"
]
|> List.map (fun name -> upcast MetadataReference.CreateFromFile (referencedAssembly name))

Expand Down
Loading