microsoft / qsharp-runtime

Runtime components for Q#
https://docs.microsoft.com/quantum
MIT License
285 stars 94 forks source link

Cannot install IQ# on ARM due to failure to build ARM version of Microsoft.Quantum.Simulator.Runtime #235

Open beraybentesen opened 4 years ago

beraybentesen commented 4 years ago

Describe the bug Can not install the library.

System information

Additional context Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/home/pi/.dotnet/tools/.store/microsoft.quantum.iqsharp/0.10.1911.1607/microsoft.quantum.iqsharp/0.10.1911.1607/tools/netcoreapp3.0/any/Microsoft.Quantum.IQSharp.dll'. An attempt was made to load a program with an incorrect format.

File name: '/home/pi/.dotnet/tools/.store/microsoft.quantum.iqsharp/0.10.1911.1607/microsoft.quantum.iqsharp/0.10.1911.1607/tools/netcoreapp3.0/any/Microsoft.Quantum.IQSharp.dll'

cgranade commented 4 years ago

Bad image format makes it sound like you're running on a different processor architecture (e.g.: x86 vs x64 vs ARM). From your bug report, it looks like you're running on a Raspberry Pi, which is ARM-based. We haven't yet officially tested on ARM yet, I don't think, so you may be running into issues due to that.

+@anpaz-msft

beraybentesen commented 4 years ago

@cgranade Thank you, looking forward to test when its arrive.

beraybentesen commented 4 years ago

@cgranade I tried build and it seems working fine.

`pi@raspberrypi:~/iqsharp$ dotnet build iqsharp.sln Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 68.93 ms for /home/pi/iqsharp/src/Core/Core.csproj. Restore completed in 55.17 ms for /home/pi/iqsharp/src/Jupyter/Jupyter.csproj. Restore completed in 81.32 ms for /home/pi/iqsharp/src/Tool/Tool.csproj. Restore completed in 7.72 ms for /home/pi/iqsharp/src/Web/Web.csproj. Restore completed in 22.64 sec for /home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj. Core -> /home/pi/iqsharp/src/Core/bin/Debug/netstandard2.1/Microsoft.Quantum.IQSharp.Core.dll Web -> /home/pi/iqsharp/src/Web/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.Web.dll Jupyter -> /home/pi/iqsharp/src/Jupyter/bin/Debug/netstandard2.1/Microsoft.Quantum.IQSharp.Jupyter.dll Tool -> /home/pi/iqsharp/src/Tool/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.dll Mocks.cs(40,38): warning CS0067: The event 'MockShell.KernelInfoRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] Mocks.cs(42,38): warning CS0067: The event 'MockShell.ShutdownRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] Mocks.cs(41,38): warning CS0067: The event 'MockShell.ExecuteRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] Tests.IQsharp -> /home/pi/iqsharp/src/Tests/bin/Debug/netcoreapp3.0/Tests.IQsharp.dll

Build succeeded.

Mocks.cs(40,38): warning CS0067: The event 'MockShell.KernelInfoRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] Mocks.cs(42,38): warning CS0067: The event 'MockShell.ShutdownRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] Mocks.cs(41,38): warning CS0067: The event 'MockShell.ExecuteRequest' is never used [/home/pi/iqsharp/src/Tests/Tests.IQsharp.csproj] 3 Warning(s) 0 Error(s)

Time Elapsed 00:01:11.77`

cgranade commented 4 years ago

Exciting that dotnet build worked! Can you try installing IQ# in development mode (see code snippet below), perhaps, to see if that works? I would expect %simulate to fail, since the QuantumSimulator target machine is compiled against x64, but %toffoli_simulate might hopefully work.

cd ~/iqsharp/src/Tool
dotnet run -- install --develop
beraybentesen commented 4 years ago

@cgranade Unfortunately, received the same error.

Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/home/pi/iqsharp/src/Tool/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.dll'. An attempt was made to load a program with an incorrect format.

File name: '/home/pi/iqsharp/src/Tool/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.dll'

cgranade commented 4 years ago

@beraybentesen: When does that error occur? Can you run dotnet run -- --version from src/Tool? Thanks for the help in sorting this out!

anpaz commented 4 years ago

I suspect the problem is not on loading IQ# but one of its dependencies. In particular, I know the Simulator dll is built for x64. I can't remember if the Q# compiler library is x64 specific too (probably not). You will need to build an ARM version of the Q# runtime (https://github.com/microsoft/qsharp-runtime). Probably one that does not include the QuantumSimulator unless you're willing to go through the effort of building the C++ simulator too. Then you can update your references to use that.

beraybentesen commented 4 years ago

@cgranade I receive the following response: dotnet run -- --version Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/home/pi/iqsharp/src/Tool/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.dll'. An attempt was made to load a program with an incorrect format.

File name: '/home/pi/iqsharp/src/Tool/bin/Debug/netcoreapp3.0/Microsoft.Quantum.IQSharp.dll'

@anpaz-msft Thank you for the info.

I tried the bootstrap.sh but received the following error:

Make sure everything is ready and builds locally. pushd src/Simulation/Native

I'd like to get things working if you might share a short guidance if possible.

Thanks,

beraybentesen commented 4 years ago

@cgranade Is there anything you would recommend ? We are willing to implement solution for our arm based cluster. Best,