Comments (15)
May be related?: H2 simulation works with error after other tests (or if you simply run it few times) https://quantum.uservoice.com/forums/906946-samples-and-documentation
from quantum.
I noticed this problem too, and I have trying to reproduce it with no success. As you point out is not the seed. Could be that we're not releasing resources. My intuition, though, is that this is a multi-threading problem, however you should be able to create multiple instances of a Simulator and run each one in parallel (which is what the tests would do), so I'm confused about what the actual problem is.
@qubeat, the H2 problem could be related, however the h2 simulation is random in nature, and we are not providing a seed, so it's not too surprising to see random failures in it.
If you guys find out anything, please let us know.
from quantum.
@anpaz-msft The failures are too big and not quite random (most are around -0.4). They also seem never appear at first run of dotnet. Seems the more runs, the more errors. Below rather an illustrative example:
from quantum.
The H2 simulation algorithm is probabilistic at different levels and it's not unexpected to see it failing; the reason for the jumps you see there is that the algorithm is finding not the ground state but a higher excitation level, which is an expected result. If you look carefully at the code, you'll notice that for each bond length we calculate the energy 3 times and select the minimum value, because, again the result may give you any excitation level and not just the ground state.
from quantum.
from quantum.
@anpaz-msft I change code to repeat 5 times and it seems work better, at least no errors after couple runs in VS Code. However I am not sure about excited states, it may be some calculation artifact as well - there is a "pit" on graphs
from quantum.
Starting to suspect the init or destroy method in Microsoft.Quantum.Simulator.Runtime.dll. Validating hypothesis. (Nope)
from quantum.
Had a linux machine run
while dotnet test Samples/UnitTesting; do :; done;
and
while dotnet test LibraryTests; do :; done;
for a number of hours on a 2 vcpu, ubuntu machine but can't seem to repro this.
from quantum.
Hmm.. LibraryTest seems to lock up with
Measured: [One;Zero;Zero;One]
measured: [Zero;One;Zero;One]
measured: [One;One;Zero;One]
measured: [Zero;Zero;One;One]
measured: [One;Zero;One;One]
measured: [Zero;One;One;One]
measured: [One;One;One;One]"
as the last output when I run these two parallel.
Can't get this to repro on windows. Getting the feeling this is something specific to the linux version.
from quantum.
After installing a nostalgia version of ubuntu (14.02) and running the tooling on a 2 vcpu vm, I can finally get the issue reproed. @anpaz-msft which os and compiler are you using to build the the Linux runtime dll ? Would it be possible to staticly link the openmp library ?
from quantum.
Testing ExpIZArcTan2NC against Exp{}. Attempt: 0
Trying ...
[xUnit.net 00:00:15.6653463] RepeatUntilSuccessCircuitsTest [FAIL]
Failed RepeatUntilSuccessCircuitsTest
Error Message:
Microsoft.Quantum.Simulation.Core.ExecutionFailException : Error:the probability to measure |+⟩ in the first ancilla must be 0.5
Expected: 0.5
Actual: 0.166666666666667
Stack Trace:
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.QSimAssertProb.<get_Body>b__6_0(ValueTuple6 _args) at Microsoft.Quantum.Simulation.Core.Operation
2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args) at Microsoft.Quantum.Samples.UnitTesting.ExpIZArcTan2NC.<get_Body>b__54_0(Qubit __in) in /home/reddog/Quantum/Samples/UnitTesting/RepeatUntilSuccessCircuits.qs:line 88 at Microsoft.Quantum.Simulation.Core.Operation
2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable.Apply(Object args) at Microsoft.Quantum.Canon.ApplyToFirstQubit.<>c.<get_Body>b__7_0(ValueTuple
2 __in) in /home/reddog/Quantum/Microsoft.Quantum.Canon/Combinators/ApplyToFirst.qs:line 28
at Microsoft.Quantum.Simulation.Core.PartialApplication3.<get_Body>b__20_0(P a) at Microsoft.Quantum.Simulation.Core.Operation
2.Apply(I a)
at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable.Apply(Object args) at Microsoft.Quantum.Extensions.Testing.AssertOperationsEqualReferenced.<get_Body>b__27_0(ValueTuple
3 __in)
at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I a) at Microsoft.Quantum.Simulation.Core.Operation
2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args)
at Microsoft.Quantum.Samples.UnitTesting.RepeatUntilSuccessCircuitsTest.<get_Body>b__34_0(QVoid __in) in /home/reddog/Quantum/Samples/UnitTesting/RepeatUntilSuccessCircuitsTests.qs:line 42
at Microsoft.Quantum.Simulation.Core.Operation`2.Apply(I a)
at Microsoft.Quantum.Simulation.XUnit.TestOperation.<get_TestOperationRunner>b__6_0(IOperationFactory sim) in C:\build-agent_work\7\s\src\simulation\Testing\TestOperation.cs:line 40
at Microsoft.Quantum.Samples.UnitTesting.SimulatorTestTargets.QuantumSimulatorTarget(TestOperation operationDescription) in /home/reddog/Quantum/Samples/UnitTesting/QuantumSimulatorTestTargets.cs:line 59
Standard Output Messages:
The seed used for this test is 763837676
Testing ExpIZArcTan2NC against Exp{}. Attempt: 0
Trying ...Total tests: 15. Passed: 12. Failed: 3. Skipped: 0.
Test Run Failed.
Test execution time: 17.2773 Seconds
rolf@Blade:~/Quantum$
from quantum.
Running a simple test;
export OMP_NUM_THREADS=1
dotnet test Samples/UnitTesting
Runs correctly,
export OMP_NUM_THREADS=2
dotnet test Samples/UnitTesting
Failes on Ubuntu 14.04 with G++-4.6 from ubuntu-toolchain-r-test.
So it implies there is a race condition i.c.w. OpenMP.
Given I can't repro it with later ubuntu versions, it might be caused by this specific version of openmp.
from quantum.
Repro steps I used
Spin up on Azure a "Ubuntu Server 14.04 LTS" from Canonical (Standard B2s (2 vcpus, 4 GB memory))
wget -q https://packages.microsoft.com/config/ubuntu/14.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
sudo apt-get install git
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
git clone https://github.com/Microsoft/Quantum.git
cd Quantum
dotnet build
dotnet test Samples/UnitTesting
Should get:
Total tests: 15. Passed: 12. Failed: 3. Skipped: 0.
Test Run Failed.
from quantum.
A bug on OpenMP is right on the money of where we were betting the problem would be.
Because this appears to be solved on the latest version and you found a workaround for travis, I don't want to do any changes on our end (like statically linking OpenMP) to fix it.
I will accept the change to reduce the number of threads on travis to 1 so we don't see this failures anymore.
from quantum.
Thanks @RolfHuisman, I've merged the changes.
from quantum.
Related Issues (20)
- H2 Broombridge file seems incorrect
- Q# installation issue through dotnet , VS code. HOT 4
- "External component has thrown an exception." for SudokuGrover running 4x4-classic HOT 5
- Resource estimator for factorization of 2048-bit semi prime integers HOT 12
- Latest LLVM version for qir/oracle-generator is 14.0. Need to update CMakefile.txt if just following instructions
- Typo in samples / interoperability / python / environment.yml HOT 1
- lo
- Using nuget restore from .NET 5.0 no longer requires first updating ca-certificates HOT 1
- Optimization: Remove redundant `list` call in `check_file` in `Build/check_indents.py` HOT 3
- PI
- Add Sparse Simulator Samples HOT 6
- BayesianPEIsCorrect test fails probabilistically HOT 1
- Add sparse simulator sample to main
- mybinder notebook integer-factorization does not work HOT 3
- Quantum Random Number Generator not working HOT 1
- `TimeoutError` but azure still connects? HOT 4
- HalfMoon example on Quantum Hardware HOT 2
- Don't use "failed" in the normal RUS loop logs
- "Prebuild Docker image" Action is broken. HOT 1
- Error in Shor's algorithm HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantum.