【问题标题】:Unable to load DLL 'Microsoft.Quantum.Simulator.Runtime.dll'无法加载 DLL 'Microsoft.Quantum.Simulator.Runtime.dll'
【发布时间】:2018-09-09 18:34:48
【问题描述】:

在尝试通过运行 Teleport 示例程序验证我的 Q# 环境时出现无法加载 DLL 'Microsoft.Quantum.Simulator.Runtime.dll' 错误。

dotnet build
dotnet run

platform windows 7 64 bit with AVX enabled. vscode with .NET Core SDK 2.0


Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'Microsoft.Quantum.Simulator.Runtime.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.Init()
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator..ctor(Boolean throwOnReleasingQubitsNotInZeroState, Nullable`1 randomNumberGeneratorSeed, Boolean disableBorrowing)
   at Microsoft.Quantum.Examples.Teleportation.Program.Main(String[] args) in C:\opt\workspace\quantum\Quantum\Samples\Teleportation\Program.cs:line 13

【问题讨论】:

    标签: c# .net visual-studio-code quantum-computing q#


    【解决方案1】:

    在 Ubuntu 仿生下,我必须安装 libgomp1,因为 Microsoft.Quantum.Simulator.Runtime.dll 依赖于 libgomp.so.1

    sudo apt install libgomp1
    

    依赖可以看这里。

    ldd -r ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1802.2202-preview/runtimes/linux-x64/native/Microsoft.Quantum.Simulator.Runtime.dll
    
    linux-vdso.so.1 (0x00007ffcbb4f4000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd537237000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd536e99000)
    libgomp.so.1 => not found
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd536aa8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd537832000)
    

    【讨论】:

    • centos 用户:yum install libgomp
    【解决方案2】:

    复制Microsoft.Quantum.Simulator.Runtime.dll from C:\Users\{user}\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\runtimes\win10-x64C:\Users\{user}\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0。虽然我没有用旧的微软量子开发工具包版本测试过,但 0.2.1802.2202 版本似乎有问题。确保检查 AVX 是否可用,您可以使用 CPU-Z 工具在说明部分进行检查。

    然后运行dotnet run 这应该会导致

    Round 0:        Sent False,     got False.
    Teleportation successful!!
    
    Round 1:        Sent True,      got True.
    Teleportation successful!!
    
    Round 2:        Sent False,     got False.
    Teleportation successful!!
    
    Round 3:        Sent False,     got False.
    Teleportation successful!!
    
    Round 4:        Sent False,     got False.
    Teleportation successful!!
    
    Round 5:        Sent False,     got False.
    Teleportation successful!!
    
    Round 6:        Sent False,     got False.
    Teleportation successful!!
    
    Round 7:        Sent True,      got True.
    Teleportation successful!!
    
    
    
    Press Enter to continue...
    

    【讨论】:

      【解决方案3】:

      模拟器仅在 Windows 10 中经过测试/支持。我强烈建议升级您的系统。

      【讨论】:

        猜你喜欢
        • 2019-02-24
        • 1970-01-01
        • 2017-06-26
        • 2012-01-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多