Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Adopt .NET6 + VS2022 in Quantum Development Kit (#966)
Browse files Browse the repository at this point in the history
With this change, we're migrating the main release train of the QDK to the most recent Long Time Support version of the .NET framework. For details about this change, refer to the original issue microsoft/qsharp-compiler#1224.

As part of this change, we're:

- Re-targeting all .NetCoreApp3.1 binaries to .NET6.0
- Updating Docker images, samples and templates.
- Libraries using .NetStandard2.1 are not affected by this change.
- The minimum supported .NET version in the QDK will also be updated from 3.1 to 6.0
- The Visual Studio extension will now target Visual Studio 2022.
  • Loading branch information
ricardo-espinoza authored Mar 17, 2022
1 parent 5be21f5 commit 1e387fa
Show file tree
Hide file tree
Showing 41 changed files with 41 additions and 101 deletions.
2 changes: 1 addition & 1 deletion AdvantageBenchmark/privateBuild/host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages> <!-- otherwise the standard library is included by the Sdk -->
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion AdvantageBenchmark/privateBuild/runTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ for ($tst=1; $tst -le 2; $tst++) {
for ($span=4; $span -ge 0; $span--) {
$env:OMP_NUM_THREADS = $thrd
$env:QDK_SIM_FUSESPAN = $span
.\bin\Release\netcoreapp3.1\host.exe $tst $tst 5
.\bin\Release\net6.0\host.exe $tst $tst 5
}
}
}
2 changes: 1 addition & 1 deletion AdvantageBenchmark/privateBuild/runTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ do
do
export OMP_NUM_THREADS=$thrd
export QDK_SIM_FUSESPAN=$span
./bin/Release/netcoreapp3.1/host $tst $tst 5
./bin/Release/net6.0/host $tst $tst 5
done
done
done
2 changes: 1 addition & 1 deletion AdvantageBenchmark/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This benchmark is intended to provide an easy way to verify the performance char

## Executing the benchmark

To execute the benchmark, compile each version of advantage.sln using `dotnet build .\advantage.sln -c Release` from their respective folders. Then the executable to run will be either `bin\Release\netcoreapp3.1\host.exe` in the privateBuild folder or `host\bin\Release\netcoreapp3.1\host.exe` in the releaseBuild folder. This executable takes parameters describing which test circuits to execute and how many loops to perform as integer arguments, such that `host.exe 1 1 5` will run 5 loops of test 1 and `host.exe 0 3 100` will run 100 loops of tests 0 through 3. Check the contents of `privateBuild\Program.cs` to see the tests that correspond to each identifier; for most machines, test 1 aka advantage 4x4 circuit is the best choice for benchmarking.
To execute the benchmark, compile each version of advantage.sln using `dotnet build .\advantage.sln -c Release` from their respective folders. Then the executable to run will be either `bin\Release\net6.0\host.exe` in the privateBuild folder or `host\bin\Release\net6.0\host.exe` in the releaseBuild folder. This executable takes parameters describing which test circuits to execute and how many loops to perform as integer arguments, such that `host.exe 1 1 5` will run 5 loops of test 1 and `host.exe 0 3 100` will run 100 loops of tests 0 through 3. Check the contents of `privateBuild\Program.cs` to see the tests that correspond to each identifier; for most machines, test 1 aka advantage 4x4 circuit is the best choice for benchmarking.

The benchmark can also be run via runTest.ps1 or runTest.sh, which performs a sweep across configured environment variables that adjust the number of threads used and gates fused in simulating the circuit. See the definition of the script used on your platform to understand how it configures the `OMP_NUM_THREADS` and `QDK_SIM_FUSESPAN` environment variables.

Expand Down
2 changes: 1 addition & 1 deletion AdvantageBenchmark/releasedBuild/host/host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

</Project>
11 changes: 2 additions & 9 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ Push-Location (Join-Path $PSScriptRoot "build")
.\prerequisites.ps1
Pop-Location

cargo install cargo-edit
Push-Location (Join-Path $PSScriptRoot "./src/Simulation/qdk_sim_rs")
# We use dotnet-script to inject the version number into Cargo.toml,
# so we go on ahead here and restore any missing tools.
# Since that Cargo.toml is referenced by CMake lists in the QIR
# runtime, this injection has to be the first thing we do.
dotnet tool restore
dotnet script inject-version.csx -- `
--template Cargo.toml.template `
--out-path Cargo.toml `
--version $Env:NUGET_VERSION;
cargo set-version $Env:NUGET_VERSION;
Pop-Location

if (-not (Test-Path Env:/AGENT_OS)) { # If not CI build, i.e. local build (if AGENT_OS envvar is not defined)
Expand Down
2 changes: 1 addition & 1 deletion build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Pack-Crate() {
$OutPath = Resolve-Path (Join-Path $PSScriptRoot $OutPath);
}
Push-Location (Join-Path $PSScriptRoot $PackageDirectory)
cargo package;
cargo package --allow-dirty;
# Copy only the .crate file, since we don't need all the intermediate
# artifacts brought in by the full folder under target/package.
Copy-Item -Force (Join-Path $PSScriptRoot .. "target" "package" "*.crate") $OutPath;
Expand Down
4 changes: 2 additions & 2 deletions build/steps-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ steps:
versionSpec: '5.6.0'

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

- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"msbuild-sdks": {
"Microsoft.Quantum.Sdk": "0.23.195983"
"Microsoft.Quantum.Sdk": "0.23.198514-beta"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public T GetFileContent<T>(string path)
public async Task<T> GetFileContentAsync<T>(string path, CancellationToken cancellationToken)
{
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(_fileContent));
return await JsonSerializer.DeserializeAsync<T>(stream, null, cancellationToken);
return await JsonSerializer.DeserializeAsync<T>(stream, options: null, cancellationToken);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Azure/Azure.Quantum.Client/Utility/FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public T GetFileContent<T>(string path)
public async Task<T> GetFileContentAsync<T>(string path, CancellationToken cancellationToken)
{
using FileStream stream = File.OpenRead(path);
return await JsonSerializer.DeserializeAsync<T>(stream, null, cancellationToken);
return await JsonSerializer.DeserializeAsync<T>(stream, options: null, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<QirGeneration>True</QirGeneration>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<QirGeneration>True</QirGeneration>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<QirGeneration>True</QirGeneration>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<QirGeneration>True</QirGeneration>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<QirGeneration>True</QirGeneration>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tools/Microsoft.Quantum.Qir.Runtime.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Quantum.QirGeneration" Version="0.23.195983" />
<PackageReference Include="Microsoft.Quantum.QirGeneration" Version="0.23.198514-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<QscVerbosity>d</QscVerbosity>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>Tests.Microsoft.Quantum.AutoSubstitution</AssemblyName>
<IsPackable>false</IsPackable>
<PlatformTarget>x64</PlatformTarget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.23.195983" />
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.23.198514-beta" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.6.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Simulation/Common/Simulators.Test.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Import Project="Simulators.Dev.props" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
<!-- Don't generate API docs for test cases. -->
Expand Down
2 changes: 1 addition & 1 deletion src/Simulation/Core/Microsoft.Quantum.Runtime.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.6.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Quantum.EntryPointDriver.Tests</RootNamespace>
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="Microsoft.Quantum.CSharpGeneration" Version="0.23.195983" />
<PackageReference Include="Microsoft.Quantum.CSharpGeneration" Version="0.23.198514-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="..\Common\Simulators.Dev.props" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IsPackable>false</IsPackable>
<QSharpDocsGeneration>false</QSharpDocsGeneration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<!-- we will provide our own -->
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<!-- we will provide our own -->
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<!-- we will provide our own -->
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ExecutionTarget>microsoft.simulator</ExecutionTarget>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<!-- we will provide our own -->
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<!-- we will provide our own -->
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
<IncludeProviderPackages>false</IncludeProviderPackages>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<!-- we will provide our own -->
<IncludeCSharpRuntime>false</IncludeCSharpRuntime>
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<ExposeReferencesViaTestNames>true</ExposeReferencesViaTestNames>
<!-- we will provide our own -->
Expand Down
12 changes: 0 additions & 12 deletions src/Simulation/qdk_sim_rs/.config/dotnet-tools.json

This file was deleted.

2 changes: 0 additions & 2 deletions src/Simulation/qdk_sim_rs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ win10
target
drop

# We inject version numbers into Cargo.toml, so don't want them stored in repo.
Cargo.toml
# In the future, it would be good to enable reproducible builds by committing
# the lockfile and using --locked in calls to cargo.
Cargo.lock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "qdk_sim_experimental"
version = "0.1.0"
version = "0.0.1-alpha"
authors = ["Microsoft"]
edition = "2018"
license = "MIT"
Expand Down
Loading

0 comments on commit 1e387fa

Please sign in to comment.