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

Commit

Permalink
Disable criterion to avoid dependency issue (#1161)
Browse files Browse the repository at this point in the history
* Disable criterion to avoid dependency issue

Since we build with a specific pinned version of Rust but do not check in a Cargo.lock, we have contradictions in our toolchain and our dependencies. For now, we avoid this issue by skipping the benchmarks that depend on criterion.

* don't use cargo edit
  • Loading branch information
swernli authored Oct 26, 2023
1 parent 0a05c0f commit 3af588c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
34 changes: 18 additions & 16 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,44 @@
$ErrorActionPreference = 'Stop'

Push-Location (Join-Path $PSScriptRoot "build")
.\prerequisites.ps1
.\prerequisites.ps1
Pop-Location

cargo install cargo-edit@0.11.0
Push-Location (Join-Path $PSScriptRoot "./src/Simulation/qdk_sim_rs")
cargo set-version $Env:NUGET_VERSION;
Pop-Location
# cargo install [email protected]
# Push-Location (Join-Path $PSScriptRoot "./src/Simulation/qdk_sim_rs")
# 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)
if (-not (Test-Path Env:/AGENT_OS)) {
# If not CI build, i.e. local build (if AGENT_OS envvar is not defined)
if ($Env:ENABLE_QIRRUNTIME -ne "false") {
Write-Host "Build release flavor of the QIR standard library"
$Env:BUILD_CONFIGURATION = "Release"
Push-Location (Join-Path $PSScriptRoot "src/Qir/Runtime")
.\build-qir-stdlib.ps1
.\build-qir-stdlib.ps1
Pop-Location
$Env:BUILD_CONFIGURATION = $null
}
if ($Env:ENABLE_NATIVE -ne "false") {
$Env:BUILD_CONFIGURATION = "Release"
Write-Host "Build release flavor of the full state simulator"
Push-Location (Join-Path $PSScriptRoot "src/Simulation/Native")
.\build-native-simulator.ps1
.\build-native-simulator.ps1
Pop-Location

Write-Host "Build release flavor of the Sparse Simulator"
& (Join-Path $PSScriptRoot "src" "Simulation" "NativeSparseSimulator" "build.ps1")

Push-Location (Join-Path $PSScriptRoot "src" "Simulation" "qdk_sim_rs")
# Don't run the experimental simulator build if we're local
# and prerequisites are missing.
$IsCI = "$Env:TF_BUILD" -ne "" -or "$Env:CI" -eq "true";
if ((Get-Command cargo -ErrorAction SilentlyContinue) -or $IsCI) {
.\build-qdk-sim-rs.ps1
} else {
Write-Verbose "cargo was not installed, skipping qdk_sim_rs build.";
}
# Don't run the experimental simulator build if we're local
# and prerequisites are missing.
$IsCI = "$Env:TF_BUILD" -ne "" -or "$Env:CI" -eq "true";
if ((Get-Command cargo -ErrorAction SilentlyContinue) -or $IsCI) {
.\build-qdk-sim-rs.ps1
}
else {
Write-Verbose "cargo was not installed, skipping qdk_sim_rs build.";
}
Pop-Location
$Env:BUILD_CONFIGURATION = $null
}
Expand Down
14 changes: 7 additions & 7 deletions src/Simulation/qdk_sim_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ built = "0.5.0"
approx = { version = "0.5.1", features = ["num-complex"] }
assert-json-diff = "2.0.1"
backtrace = "=0.3.65"
criterion = { version = "0.3", features = ['html_reports', 'csv_output'] }
# criterion = { version = "0.3", features = ['html_reports', 'csv_output'] }
ndarray = { version = "0.15.4", features = ["approx"] }

[[bench]]
harness = false
name = "c_api_benchmark"
# [[bench]]
# harness = false
# name = "c_api_benchmark"

[[bench]]
harness = false
name = "microbenchmark"
# [[bench]]
# harness = false
# name = "microbenchmark"
16 changes: 8 additions & 8 deletions src/Simulation/qdk_sim_rs/test-qdk-sim-rs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ Push-Location $PSScriptRoot
}

# Run performance benchmarks as well.
cargo bench
$script:allOk = $script:allOk -and $LASTEXITCODE -eq 0;
# cargo bench
# $script:allOk = $script:allOk -and $LASTEXITCODE -eq 0;

# This step isn't required, but we use it to upload run summaries.
$reportPath = (Join-Path "target" "criterion");
$perfDest = (Join-Path $Env:DROPS_DIR "perf" "qdk_sim_rs");
if (Get-Item -ErrorAction SilentlyContinue $reportPath) {
New-Item -Type Directory -Force -Path $perfDest;
Copy-Item -Recurse -Force -Path $reportPath -Destination $perfDest;
}
# $reportPath = (Join-Path "target" "criterion");
# $perfDest = (Join-Path $Env:DROPS_DIR "perf" "qdk_sim_rs");
# if (Get-Item -ErrorAction SilentlyContinue $reportPath) {
# New-Item -Type Directory -Force -Path $perfDest;
# Copy-Item -Recurse -Force -Path $reportPath -Destination $perfDest;
# }

# Free disk space by cleaning up.
# Note that this takes longer, but saves ~1 GB of space, which is
Expand Down

0 comments on commit 3af588c

Please sign in to comment.