Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
935 changes: 496 additions & 439 deletions Simulation.sln

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions bootstrap.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ git --version || GOTO missingGit
:: Initialize C++ runtime project
CALL :runtimeBootstrap || EXIT /B 1

:: Initialize the compiler's nuspec file
CALL :nuspecBootstrap || EXIT /B 1

:: Next steps are only needed for developers environment, they are skipped for cloud builds.
IF NOT "%AGENT_ID%" == "" GOTO EOF

Expand All @@ -33,17 +30,6 @@ popd
EXIT /B


:: Bootstrap the compiler nuspec
:nuspecBootstrap
pushd src\Simulation\CsharpGeneration
CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1
popd

pushd src\Simulation\Simulators
CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1
popd
EXIT /B

:missingGit
echo.
echo This script depends on git.
Expand Down
24 changes: 24 additions & 0 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

Push-Location (Join-Path $PSScriptRoot "src/Simulation/CsharpGeneration")
.\FindNuspecReferences.ps1
Pop-Location

Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators")
.\FindNuspecReferences.ps1
Pop-Location

# bootstrap native folder
if ($Env:ENABLE_NATIVE -ne "false") {
## Run the right script based on the OS.
if (-not (Test-Path Env:AGENT_OS) -or ($Env:AGENT_OS.StartsWith("Win"))) {
.\bootstrap.cmd
} else {
.\bootstrap.sh
}
} else {
Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
}
Binary file added build/assets/qdk-nuget-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ $ErrorActionPreference = 'Stop'
& "$PSScriptRoot/set-env.ps1"
$all_ok = $True

Write-Host "##[info]Build Native simulator"
cmake --build (Join-Path $PSScriptRoot "../src/Simulation/Native/build") --config $Env:BUILD_CONFIGURATION
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator."
$script:all_ok = $False
if ($Env:ENABLE_NATIVE -ne "false") {
Write-Host "##[info]Build Native simulator"
$nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
cmake --build $nativeBuild --config $Env:BUILD_CONFIGURATION
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator."
$script:all_ok = $False
}
} else {
Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
}


function Build-One {
param(
[string]$action,
Expand Down
38 changes: 13 additions & 25 deletions build/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,22 @@ variables:
Drop.Native: $(System.DefaultWorkingDirectory)/xplat

jobs:
- job: macOS
pool:
vmImage: 'macOS-latest'
steps:
- template: steps-xplat.yml

- job: build
displayName: Build
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)

- job: Linux
pool:
vmImage: 'ubuntu-latest'
steps:
- template: steps-xplat.yml


- job: Windows
pool:
vmImage: 'windows-2019'
dependsOn:
- macOS
- Linux
condition: succeeded()
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download xplat native binaries'
inputs:
artifactName: xplat
downloadPath: $(System.DefaultWorkingDirectory)
- template: steps.yml

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:
Expand Down
18 changes: 9 additions & 9 deletions build/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
);
Assemblies = @(
".\src\Azure\Azure.Quantum.Client\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Azure.Quantum.Client.dll",
".\src\simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll",
".\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.Simulators.dll",
".\src\Simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll",
".\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.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;
16 changes: 7 additions & 9 deletions build/steps-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ steps:
# Pre-reqs
##
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.2.0'
displayName: 'Use NuGet 5.6.0'
inputs:
versionSpec: '5.2.0'
versionSpec: '5.6.0'

- task: UseDotNet@2
displayName: 'Use .NET Core SDK 3.1.100'
displayName: 'Use .NET Core SDK 3.1.300'
inputs:
packageType: sdk
version: '3.1.100'
version: '3.1.300'


##
# Bootstrap
##
- task: BatchScript@1
displayName: 'Prepare build'
inputs:
filename: bootstrap.cmd
modifyEnvironment: true
- pwsh: ./bootstrap.ps1
displayName: "Bootstrap repository"
workingDirectory: $(System.DefaultWorkingDirectory)
3 changes: 2 additions & 1 deletion build/steps-wrap-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ steps:
testRunTitle: 'Q# runtime tests'

- task: PublishSymbols@1
displayName: 'Publish symbols'
displayName: 'Publish symbols (Windows only)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
continueOnError: true
inputs:
SearchPattern: '$(System.DefaultWorkingDirectory)/src/**/*.pdb'
Expand Down
50 changes: 0 additions & 50 deletions build/steps-xplat.yml

This file was deleted.

3 changes: 2 additions & 1 deletion build/steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ steps:


- powershell: ./pack.ps1
displayName: "Pack Q# runtime"
displayName: "Pack Q# runtime (Windows only)"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
workingDirectory: $(System.DefaultWorkingDirectory)/build


Expand Down
21 changes: 12 additions & 9 deletions build/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
& "$PSScriptRoot/set-env.ps1"
$all_ok = $True

Write-Host "##[info]Test Native simulator"
pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
cmake --build . --config $Env:BUILD_CONFIGURATION
ctest -C $Env:BUILD_CONFIGURATION
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator"
$script:all_ok = $False
if ($Env:ENABLE_NATIVE -ne "false") {
Write-Host "##[info]Test Native simulator"
pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
cmake --build . --config $Env:BUILD_CONFIGURATION
ctest -C $Env:BUILD_CONFIGURATION
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator"
$script:all_ok = $False
}
popd
} else {
Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
}
popd


function Test-One {
Param($project)
Expand Down
13 changes: 12 additions & 1 deletion src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public CloudJob(IWorkspace workspace, JobDetails jobDetails)
/// <summary>
/// Gets an URI to access the job.
/// </summary>
public Uri Uri => throw new NotImplementedException();
public Uri Uri => GenerateUri();

/// <summary>
/// Gets the workspace.
Expand Down Expand Up @@ -91,5 +91,16 @@ public async Task CancelAsync(CancellationToken cancellationToken = default)
CloudJob job = (CloudJob)await this.Workspace.CancelJobAsync(this.Details.Id, cancellationToken);
this.Details = job.Details;
}

private Uri GenerateUri()
{
if (!(this.Workspace is Workspace cloudWorkspace))
{
throw new NotSupportedException($"{typeof(CloudJob)}'s Workspace is not of type {typeof(Workspace)} and does not have enough data to generate URI");
}

var uriStr = $"https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/{cloudWorkspace.SubscriptionId}/resourceGroups/{cloudWorkspace.ResourceGroupName}/providers/Microsoft.Quantum/Workspaces/{cloudWorkspace.WorkspaceName}/job_management?microsoft_azure_quantum_jobid={Id}";
return new Uri(uriStr);
}
}
}
6 changes: 6 additions & 0 deletions src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ private Workspace(
}
}

public string ResourceGroupName { get => resourceGroupName; }

public string SubscriptionId { get => subscriptionId; }

public string WorkspaceName { get => workspaceName; }

/// <summary>
/// Gets or sets the jobs client.
/// Internal only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/qsharp-runtime</PackageProjectUrl>
<PackageTags>Azure Quantum Q# Qsharp</PackageTags>
<PackageIconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</PackageIconUrl>
<PackageIcon>qdk-nuget-icon.png</PackageIcon>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

Expand Down Expand Up @@ -46,4 +46,8 @@
<ProjectReference Include="..\..\Simulation\Core\Microsoft.Quantum.Runtime.Core.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\build\assets\qdk-nuget-icon.png" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Microsoft.Quantum.Development.Kit</id>
<version>$version$</version>
Expand All @@ -9,7 +9,7 @@

<license type="expression">MIT</license>
<projectUrl>https://docs.microsoft.com/en-us/quantum</projectUrl>
<iconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</iconUrl>
<icon>images\qdk-nuget-icon.png</icon>

<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Provides tools for developing quantum algorithms in the Q# programming language.</description>
Expand All @@ -30,6 +30,7 @@
<file src="Props\*.xaml" target="build" />
<file src="..\..\NOTICE.txt" target="\ThirdPartyNotice.txt" />
<file src="..\Simulation\CsharpGeneration.App\bin\$Configuration$\netcoreapp3.1\publish\**" target="tools\qsc" exclude="**\*.pdb" />
<file src="..\..\build\assets\qdk-nuget-icon.png" target="images" />
</files>

</package>
Loading