JuliaInv / jInv.jl

Flexible Framework for Parallel PDE Parameter Estimation in Julia
MIT License
45 stars 14 forks source link

exJointEikonalDC.ipynb notebook #40

Open finmod opened 7 years ago

finmod commented 7 years ago

At this command line, I get this error

Ainv = getMUMPSsolver() pForDC = DivSigGradParam(Mdc, SourcesDC, ReceiversDC, [], Ainv) gloc = GlobalToLocal(Iact'Mesh2Mesh,Mesh2Mesh'sigback); WdDC = 1./(mean(abs(vec(dobsDC)))/2+abs(dobsDC)); @everywhere begin function velToConductMod(v,mid,a,b) d = (b-a)./2.0; dinv = 10; tt = dinv.(mid - v); t = (d.(tanh(tt)+1) + a); dt = -(dinvd)(sech(tt)).^2; dt = (2.0-v./mid).dt + (-1./mid).t; t = t.*(2.0-v./mid); return vec(t),spdiagm(vec(dt)) end modfunDC(m) = velToConductMod(m,3.0,0.1,1.0); end pMisDC = initRemoteChannel(getMisfitParam,workers()[end],pForDC,WdDC,dobsDC,SSDFun,modfunDC,gloc)

Error:

MethodError: no method matching DivSigGrad.DivSigGradParam(::jInv.Mesh.RegularMesh, ::SparseMatrixCSC{Float64,Int64}, ::SparseMatrixCSC{Float64,Int64}, ::Array{Any,1}, ::jInv.LinearSolvers.MUMPSsolver) Closest candidates are: DivSigGrad.DivSigGradParam(::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at C:\Users\Denis.julia\v0.5\DivSigGrad\src\DivSigGrad.jl:27 DivSigGrad.DivSigGradParam(::jInv.Mesh.AbstractMesh, ::Union{Array{T,N},SparseMatrixCSC{Tv,Ti<:Integer},SparseVector{Tv,Ti<:Integer}}, ::Union{Array{SparseMatrixCSC,N},SparseMatrixCSC{Tv,Ti<:Integer},SparseVector{Tv,Ti<:Integer}}, ::Array{Float64,N}, ::SparseMatrixCSC{Float64,Ti<:Integer}, ::jInv.LinearSolvers.AbstractSolver) at C:\Users\Denis.julia\v0.5\DivSigGrad\src\DivSigGrad.jl:27 DivSigGrad.DivSigGradParam{T}(::Any) at sysimg.jl:53

Pbellive commented 7 years ago

Hi finmod, Sorry about that. The DivSigGrad.jl API has changed slightly since this example was put together and the example wasn't updated. Thanks for finding the bug in the example. We'll push an updated example soon. In the meantime you can use the following simple workaround. Just replace the line

pForDC      = DivSigGradParam(Mdc, SourcesDC, ReceiversDC, [], Ainv)

with

pForDC      = DivSigGradParam(Mdc, SourcesDC, ReceiversDC, [],spzeros(0,0), Ainv)

Please reply if that doesn't work.

Patrick

finmod commented 7 years ago

Hello Patrick,

Worked as prescribed. Thank you.

A bit further down, some glitch with the workers and MUMPS:

mc,Dc,flag,His = projGNCG(copy(mref[:]),pInv,pMis,dumpResults = plotIntermediates);

On worker 9: error compiling solveLinearSystem: error compiling solveLinearSystem!: error compiling factorMUMPS: could not load library "C:\Users\Denis.julia\v0.5\MUMPS\lib\MUMPS" The specified module could not be found.

in getData at C:\Users\Denis.julia\v0.5\DivSigGrad\src\getData.jl:44 in getData at C:\Users\Denis.julia\v0.5\DivSigGrad\src\getData.jl:41 in computeMisfit at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\computeMisfit.jl:28 in computeMisfit at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\computeMisfit.jl:66 in computeMisfit at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\computeMisfit.jl:58 in #647 at .\multi.jl:1421 in run_work_thunk at .\multi.jl:1001 in macro expansion at .\multi.jl:1421 [inlined] in #646 at .\event.jl:68 in #remotecall_fetch#628(::Array{Any,1}, ::Function, ::Function, ::Base.Worker, ::Future, ::Vararg{Any,N}) at .\multi.jl:1070 in remotecall_fetch(::Function, ::Base.Worker, ::Future, ::Vararg{Any,N}) at .\multi.jl:1062 in #remotecall_fetch#631(::Array{Any,1}, ::Function, ::Function, ::Int64, ::Future, ::Vararg{Any,N}) at .\multi.jl:1080 in remotecall_fetch(::Function, ::Int64, ::Future, ::Vararg{Any,N}) at .\multi.jl:1080 in macro expansion at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\computeMisfit.jl:127 [inlined] in (::jInv.InverseSolve.##35#40{Array{Float64,1},Array{RemoteChannel,1},Bool,Array{Any,1},Array{Future,1},jInv.InverseSolve.#updateRes#36{Array{Any,1}},jInv.InverseSolve.#updateDF#37})() at .\task.jl:360

in sync_end() at .\task.jl:311 in macro expansion at .\task.jl:327 [inlined] in computeMisfit(::Array{Float64,1}, ::Array{RemoteChannel,1}, ::Bool, ::Array{Int64,1}) at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\computeMisfit.jl:118 in #projGN#19(::Array{Any,1}, ::#plotIntermediates, ::Int64, ::jInv.InverseSolve.#projPCG, ::Function, ::Array{Float64,1}, ::jInv.InverseSolve.InverseParam, ::Array{RemoteChannel,1}) at C:\Users\Denis.julia\v0.5\jInv\src\InverseSolve\projGN.jl:85 in (::jInv.InverseSolve.#kw##projGN)(::Array{Any,1}, ::jInv.InverseSolve.#projGN, ::Array{Float64,1}, ::jInv.InverseSolve.InverseParam, ::Array{RemoteChannel,1}) at .\:0

All other notebooks are perfect. Superb work that I just discovered. Will be back with more interesting questions.

lruthotto commented 7 years ago

seems like you haven't successfully installed MUMPS on your system. Note, it needs compilation. You don't necessarily need it for this example and you can replace getMUMPSsolver by getJuliaSolver.

finmod commented 7 years ago

You are right. On Windows 10, MUMPS is not installed and compiled properly. In addition, Pkg.test("MUMPS") does not work. getJuliaSolver is working fine although I do not know what it is.

This MUMPS problem is the only one I have encountered in installing and running the jInv examples. This is exceptionally good in my experience with PDE parameter estimation packages in Julia (the forward and inverse problem). I will try jInv on Ubuntu 16.04 to see if MUMPS works better there on my laptop.

Since MUMPS is at the center of your paper jInv - A flexible......, will you persist into getting MUMPS.jl to work on Windows or is it being deprecated in favour of JuliaSolver?

This issue can now be closed after adjustement of the README file for what we have learned.

lruthotto commented 7 years ago

thanks a lot. I'm glad you like the package.

In principle, the MUMPS version we used (https://github.com/JuliaSparse/MUMPS.jl) does work on Windows. Some other jInv users have it working correctly. Note that currently there is no easy way to compile the binaries from within julia. So, you need to run the makefile in MUMPS.jl/src by yourself before Pkg.test("MUMPS") will work. On ubuntu that should work directly.

getJuliaSolver uses the sparse linear solvers provided in Julia (based on UMFpack). This gives the same results (up to rounding) and does not affect any behavior in jInv. For all the examples it should run great and we might change the notebooks at some point since they are more thought of as teaching tools. Note that the Julia solver is less efficient than MUMPS (in terms of CPU time and memory) and so for medium-sized problems MUMPS is the way to go. For really large problems you'll have to use iterative solvers, which we also support. Providing this flexibility with minimal burden on the user was a main point in designing the toolbox, but might take some time to get used to.

finmod commented 7 years ago

Just insisting a bit to run the makefile in MUMPS/src if it is simple, I get this:


Visual Studio 2017 Developer Command Prompt v15.0.26430.6 Copyright (c) 2017 Microsoft Corporation


C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cd C:\Users\Denis.julia\v0.5\MUMPS\src

C:\Users\Denis.julia\v0.5\MUMPS\src>NMAKE

Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved.

makefile(6) : fatal error U1052: file '$(topdir)/Makefile.inc' not found Stop.

C:\Users\Denis.julia\v0.5\MUMPS\src>dir Volume in drive C is OS Volume Serial Number is 0C4C-9799

Directory of C:\Users\Denis.julia\v0.5\MUMPS\src

25-May-17 11:52 AM

. 25-May-17 11:52 AM .. 23-May-17 05:39 PM 4,044 call_mumps_cmplx_p.f90 23-May-17 05:39 PM 3,992 call_mumps_p.f90 23-May-17 05:39 PM 1,846 compiler_options.in 23-May-17 05:39 PM 563 Makefile 23-May-17 05:39 PM 5,557 Makefile.inc 23-May-17 05:39 PM metis-5.1.0 23-May-17 05:39 PM 537 MUMPS.jl 23-May-17 05:39 PM 5,923 MUMPSfuncs.jl 23-May-17 05:39 PM MUMPS_5.0.1 23-May-17 05:39 PM 8,117 mumps_cmplx_p.f90 23-May-17 05:39 PM 6,894 mumps_p.f90 9 File(s) 37,473 bytes 4 Dir(s) 202,518,253,568 bytes free

C:\Users\Denis.julia\v0.5\MUMPS\src>cd C:\Users\Denis.julia\v0.5\MUMPS\src\MUMPS_5.0.1

C:\Users\Denis.julia\v0.5\MUMPS\src\MUMPS_5.0.1>dir Volume in drive C is OS Volume Serial Number is 0C4C-9799

Directory of C:\Users\Denis.julia\v0.5\MUMPS\src\MUMPS_5.0.1

23-May-17 05:39 PM

. 23-May-17 05:39 PM .. 23-May-17 05:39 PM 23,160 ChangeLog 23-May-17 05:39 PM 1,709 CREDITS 23-May-17 05:39 PM doc 23-May-17 05:39 PM include 23-May-17 05:39 PM 11,027 INSTALL 23-May-17 05:39 PM lib 23-May-17 05:39 PM libseq 23-May-17 05:39 PM 2,257 LICENSE 23-May-17 05:39 PM Make.inc 23-May-17 05:39 PM 2,008 Makefile 23-May-17 05:39 PM 5,557 Makefile.inc 23-May-17 05:39 PM MATLAB 23-May-17 05:39 PM PORD 23-May-17 05:39 PM 2,354 README 23-May-17 05:39 PM SCILAB 23-May-17 05:39 PM src 23-May-17 05:39 PM 43 VERSION 8 File(s) 48,115 bytes 11 Dir(s) 202,518,253,568 bytes free

C:\Users\Denis.julia\v0.5\MUMPS\src\MUMPS_5.0.1>

finmod commented 7 years ago

@lruthotto On running MUMPS on Windows, have you considered using the WinRPM package. I have seen it used by others to avoid seperate compilation of mumps, suite sparse etc...

Seperately, have you received my email inquiring about an extension of JInv to parallel-in-time algorithms in Julia?

lruthotto commented 7 years ago

No, we haven’t looked into WinRPM yet since most of us are using Unix/MacOS. MUMPS is used optionally for large-scale problems. We found the julia built-in solver to work great for small to medium scale problems and will replace MUMPS in our examples.

On Jun 8, 2017, at 6:34 AM, finmod notifications@github.com wrote:

@lruthotto https://github.com/lruthotto On running MUMPS on Windows, have you considered using the WinRPM package. I have seen it used by others to avoid seperate compilation of mumps, suite sparse etc...

Seperately, have you received my email inquiring about an extension of JInv to parallel-in-time algorithms in Julia?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaInv/jInv.jl/issues/40#issuecomment-307065576, or mute the thread https://github.com/notifications/unsubscribe-auth/AEDYB6kI6SBKcFopzoU5Ruj-Vs55Ze4Sks5sB84fgaJpZM4Nj8Ws.