Closed ievutec closed 7 years ago
Did you follow the directions at https://github.com/StationQ/Liquid/blob/master/GettingStarted.md#osx? It sounds like Liquid1.dll is missing, or isn't where it's expected to be.
I have the same issue in Ubuntu 16.04, F# 4.1, mono 5.0.1.1 and Liqui|> master/7681f4fd.
Installed Liqui|> last week and was successfully playing with pre-built functions. However, when I tried scripts I stumbled over the problem being reported in this issue. Did not try all of the scripts but each one I tried fails similarly. To give more complete logs:
mono /Liquid/linux/Liquid.exe /s QuAM.fsx "QuAM()"
0:0000.0/=============== Logging to: Liquid.log opened ================
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
0:0000.0/Error running function QuAM(): Exception has been thrown by the target of an invocation.
0:0000.0/Inner: Method 'Microsoft.Research.Liquid.Ket..ctor' not found.
0:0000.0/Error occured at Invoke
0:0000.0/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/ at ad.c (System.String A_0) [0x0023c]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/!!! ERROR: Exiting Liquid
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`
Compilation of the script alone completes successfully:
mono /Liquid/linux/Liquid.exe /s QuAM.fsx "__show("test")"
0:0000.0/=============== Logging to: Liquid.log opened ================
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
0:0000.0/test
0:0000.0/=============== Logging to: Liquid.log closed ================
so the base Liquid1.dll seems to be loaded. Subsequent usage of generated library fails as before:
mono /Liquid/linux/Liquid.exe /l QuAM.dll "QuAM()"
0:0000.0/=============== Logging to: Liquid.log opened ================
0:0000.0/Error running function QuAM(): Exception has been thrown by the target of an invocation.
0:0000.0/Inner: Method 'Microsoft.Research.Liquid.Ket..ctor' not found.
0:0000.0/Error occured at Invoke
0:0000.0/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/ at ad.c (System.String A_0) [0x0023c]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/!!! ERROR: Exiting Liquid
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This doesn't seem to happen only with Ket constructors though. For instance, the show function being invoked from a script throws the same exception:
mono /Liquid/linux/Liquid.exe /s Ferro.fsx "Ferro()"
0:0000.0/=============== Logging to: Liquid.log opened ================
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
0:0000.0/Error running function Ferro(): Exception has been thrown by the target of an invocation.
0:0000.0/Inner: Method 'Microsoft.Research.Liquid.Util.show' not found.
0:0000.0/Error occured at Invoke
0:0000.0/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/ at ad.c (System.String A_0) [0x0023c]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4]
0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.0/!!! ERROR: Exiting Liquid
0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So it seems like all/some base Liquid functions are not visible within the scope of the library built from a script?
Any hints would be much appreciated!
@alan-geller just to confirm, the libraries are loaded, at least in my case. As I mentioned above, pre-built functions are accessible. Also, when I load the user library with /l Ferro.dll
, lsof
tells me that both /Liquid/linux/Liquid1.dll
and Ferro.dll
are loaded by the process.
@ishapoval @ievutec Hmm... I'll check with Dave, who did the Linux and Mac testing (and who was the developer of Liquid in the first place). My guess is that there's something about the way script compilation happens on the Mac and Linux that isn't capturing the library dependency correctly, and is making mono thing that the type your script is looking for is different from the type in the library. Dave is out of town, so it may take a day or two for me to get back.
Sorry for the delay, I've been traveling in Europe (speeding up experiments in a quantum physics lab). At the moment, I don't have access to either a MacOS or Linux box that I can debug on... so it will have to wait until I get back (a couple weeks). It sounds like something in the mono runtime changed that I'm going to have to track down. This used to work AFAIK, so I have no idea what happened. Again, apologies for not being able to jump right on this.
@alan-geller @dbwz8 Thank you for all the help! I've confirmed that the libraries are definitely loaded too and all of the pre-built functions work as far as I can see, so it might just be something in the build or something specific to this version of MacOS (for the record it's El Capitan, v. 10.11.6). I'll keep trying to run some scripts but right now I can't seem to find where the issue's located.
@dbwz8 Thanks a lot! I would be happy to help since this issue becomes a blocker for me. I can provide any extra debug logs, if this can help.
Hi there, I took a quick look. I was able to reproduce your problem with the latest Ubuntu/fsharp/liquid. I'm uncertain of what is causing the problem, however, I noticed that if instead of trying to compile using liquid you load your script using the fsharp interactive console, it actually works. For example, this works:
anpaz@test:~/Liquid/linux$ fsharpi --use:Entangle1.fsx
F# Interactive for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
>
--> Referenced '/home/anpaz/Liquid/linux/Liquid1.dll' (file may be locked by F# Interactive process)
0:0000.0/
0:0000.0/ Secs/Op S/Qubit Mem(GB) Operation
0:0000.0/ ------- ------- ------- ---------
0:0000.0/
0:0000.0/===========================================================================================
0:0000.0/= The Language-Integrated Quantum Operations (LIQUi|>) Simulator =
0:0000.0/= Copyright (c) 2015,2016 Microsoft Corporation =
0:0000.0/= If you use LIQUi|> in your research, please follow the guidelines at =
0:0000.0/= https://github.com/msr-quarc/Liquid for citing LIQUi|> in your publications. =
0:0000.0/===========================================================================================
0:0000.0/
0:0000.0/ 0.070 0.070 0.423 Created single state vector
0:0000.0/ 0.042 0.042 0.423 Did Hadamard
0:0000.0/ 0.006 0.006 0.423 Did CNOT: 1
0:0000.0/ 0.007 0.004 0.423 Did CNOT: 2
0:0000.0/ 0.008 0.003 0.423 Did CNOT: 3
0:0000.0/ 0.010 0.003 0.423 Did CNOT: 4
0:0000.0/ 0.011 0.002 0.423 Did CNOT: 5
0:0000.0/ 0.012 0.002 0.423 Did CNOT: 6
0:0000.0/ 0.013 0.002 0.423 Did CNOT: 7
0:0000.0/ 0.015 0.002 0.423 Did CNOT: 8
0:0000.0/ 0.017 0.002 0.423 Did CNOT: 9
0:0000.0/ 0.008 0.001 0.423 Did Measure
0:0000.0/
0:0000.0/
0:0000.0/ Secs/Op S/Qubit Mem(GB) Operation
0:0000.0/ ------- ------- ------- ---------
0:0000.0/ 0.023 0.023 0.423 Straight function calls
0:0000.0/ 0.010 0.010 0.423 Compile cost
0:0000.0/ 0.019 0.019 0.423 Compiled circuit run time
0:0000.0/ 0.071 0.071 0.488 Optimization cost
0:0000.0/ 0.004 0.004 0.488 Optimized circuit run time
0:0000.0/Circuit dump (in Liquid.log):
0:0000.0/Optimized circuit:
0:0000.0/Writing: Entangle2raw.htm (split=100.00% scale=100.00%)
0:0000.0/Writing: Entangle2raw.tex (split=100.00% scale=100.00%)
0:0000.0/ Doing columns: 0 - 13
0:0000.0/Writing: Entangle2opt.htm (split=100.00% scale=100.00%)
0:0000.0/Writing: Entangle2opt.tex (split=100.00% scale=100.00%)
0:0000.0/ Doing columns: 0 - 5
type QubitTimer =
class
new : unit -> QubitTimer
member Show : str:string * ?i:int * ?reset:bool -> unit
end
module Script = begin
val Entangle1 : entSiz:int -> unit
val Entangle2 : entSiz:int -> unit
end
val it : unit = ()
>
Again, if you try to load it into Liquid using /s
it fails as you point it out:
anpaz@test:~/Liquid/linux$ mono Liquid.exe /s Entangle1.fsx "Entangle1(19)"
0:0000.0/
0:0000.0/===========================================================================================
0:0000.0/= The Language-Integrated Quantum Operations (LIQUi|>) Simulator =
0:0000.0/= Copyright (c) 2015,2016 Microsoft Corporation =
0:0000.0/= If you use LIQUi|> in your research, please follow the guidelines at =
0:0000.0/= https://github.com/msr-quarc/Liquid for citing LIQUi|> in your publications. =
0:0000.0/===========================================================================================
0:0000.0/
0:0000.0/=============== Logging to: Liquid.log opened ================
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
0:0000.1/Error running function Entangle1(19): Exception has been thrown by the target of an invocation.
0:0000.1/Inner: Method 'Microsoft.Research.Liquid.Ket..ctor' not found.
0:0000.1/Error occured at Invoke
0:0000.1/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.1/ at ad.c (System.String A_0) [0x0023c]
0:0000.1/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.1/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4]
0:0000.1/ in <16e8952738114e09bd59d5cb36925823>:0
0:0000.1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0:0000.1/!!! ERROR: Exiting Liquid
0:0000.1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Do you want to give it a try with fsharp interactive? I think that should get you unblocked.
Cheers
nice catch, wasn't expecting to get rid of it in interactive mode.. yes, the workaround is sufficient for now. thanks!!
@anpaz-msft That works wonderfully thanks! I guess there's still a need to fix the issue internally but that's fine as a bypass for the sake of testing scripts.
This gets more and more interesting (spent some time on it today). Could one of you (@ievutec or @ishapoval) try something for me? Go to the /Liquid/bin
directory and copy FSharp.Core.*
to the /Liquid/linux
directory and see if everything starts magically working. It looks like there was an incompatible change in the FSharp runtime that caused this. If it works for you, I'll just bundle those files in the linux directory. Thanks!
Just tried and this indeed fixes the problem! Thanks a lot!
P.S. would be great to have nightlies running for the Linux platform to catch this sort of issues.
Yep, worked like a charm! Thanks for everything!
Hey! I've recently installed the Liqui|> software on my Mac together with Visual Studio Community and all the necessities, but for some reason every time I try to run some simple simulations (like, for example, the first one in the tutorial videos) I get this Error log:
0:0000.1/Error running function Try(): Exception has been thrown by the target of an invocation. 0:0000.1/Inner: Method 'Microsoft.Research.Liquid.Ket..ctor' not found. 0:0000.1/Error occured at Invoke 0:0000.1/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0:0000.1/ at ad.c (System.String A_0) [0x0023c] 0:0000.1/ in <16e8952738114e09bd59d5cb36925823>:0 0:0000.1/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4] 0:0000.1/ in <16e8952738114e09bd59d5cb36925823>:0 0:0000.1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0:0000.1/!!! ERROR: Exiting Liquid 0:0000.1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
It doesn't seem to be able to find certain methods and no matter what I do, the situtation stays pretty grim. Please help, if there's any hope!
Thank you