slimgroup / JUDI.jl

Julia Devito inversion.
https://slimgroup.github.io/JUDI.jl
MIT License
96 stars 30 forks source link

lsrtm_objective produces wrong results w/ selected frequencies or optimal checkpointing #63

Closed ziyiyin97 closed 3 years ago

ziyiyin97 commented 3 years ago

Script is here https://github.com/slimgroup/JUDI.jl/blob/c9bda1244f0cd4863cea47f475ce1769faf14cb6/test/MFE.jl

  1. When inputting selected frequencies in the options, lsrtm_objective always outputs all zeros as the gradient.
  2. When doing optimal checkpointing, lsrtm_objective does not do what it is supposed to do, i.e. outputing 0.5*||Jx-d+d0||_2^2 and J^T(Jx-d+d0).
  3. lsrtm_objective w/ optimal checkpointing and linear data produces error
    
    ERROR: LoadError: PyError ($(Expr(:escape, :(ccall(#= /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ValueError'>
    ValueError('Unrecognized argument rcvu=rcvul(time, p_rcvul)')
    File "/Users/francisyin/.julia/dev/JUDI/src/pysource/interface.py", line 665, in J_adjoint_checkpointing
    wrap_fw = CheckpointOperator(op_f, m=model.m, **uk)
    File "/Users/francisyin/.julia/dev/JUDI/src/pysource/checkpoint.py", line 29, in __init__
    op_default_args = self.op._prepare_arguments(**kwargs)
    File "/Users/francisyin/.local/lib/python3.7/site-packages/devito/operator/operator.py", line 500, in _prepare_arguments
    raise ValueError("Unrecognized argument %s=%s" % (k, v))

Stacktrace: [1] pyerr_check at /Users/francisyin/.julia/packages/PyCall/BD546/src/exception.jl:62 [inlined] [2] pyerr_check at /Users/francisyin/.julia/packages/PyCall/BD546/src/exception.jl:66 [inlined] [3] _handle_error(::String) at /Users/francisyin/.julia/packages/PyCall/BD546/src/exception.jl:83 [4] macro expansion at /Users/francisyin/.julia/packages/PyCall/BD546/src/exception.jl:97 [inlined] [5] #107 at /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:43 [inlined] [6] disable_sigint at ./c.jl:446 [inlined] [7] __pycall! at /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:42 [inlined] [8] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{PyCall.PyObject,Array{Float32,2},Array{Float32,2},Array{Float32,2},Array{Float32,2}}, ::Int64, ::PyCall.PyObject) at /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:29 [9] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{PyCall.PyObject,Array{Float32,2},Array{Float32,2},Array{Float32,2},Array{Float32,2}}, ::Base.Iterators.Pairs{Symbol,Integer,NTuple{7,Symbol},NamedTuple{(:is_residual, :return_obj, :t_sub, :space_order, :born_fwd, :nlind, :isic),Tuple{Bool,Bool,Int64,Int64,Bool,Bool,Bool}}}) at /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:11 [10] pycall(::PyCall.PyObject, ::Type{Tuple{Float32,Array{Float32,2}}}, ::PyCall.PyObject, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Symbol,Integer,NTuple{7,Symbol},NamedTuple{(:is_residual, :return_obj, :t_sub, :space_order, :born_fwd, :nlind, :isic),Tuple{Bool,Bool,Int64,Int64,Bool,Bool,Bool}}}) at /Users/francisyin/.julia/packages/PyCall/BD546/src/pyfncall.jl:80 [11] lsrtm_objective(::Model, ::judiVector{Float32,Array{Float32,2}}, ::judiVector{Float32,Array{Float32,2}}, ::PhysicalParameter{Float32}, ::Options; nlind::Bool) at /Users/francisyin/.julia/dev/JUDI/src/TimeModeling/Modeling/lsrtm_objective_serial.jl:31 [12] #165 at /Users/francisyin/.julia/dev/JUDI/src/TimeModeling/Modeling/lsrtm_objective_parallel.jl:22 [inlined] [13] judipmap(::JUDI.var"#165#167"{Options,Bool,Model,judiVector{Float32,Array{Float32,2}},judiVector{Float32,Array{Float32,2}},PhysicalParameter{Float32}}, ::UnitRange{Int64}) at /Users/francisyin/.julia/dev/JUDI/src/TimeModeling/Modeling/utils.jl:5 [14] lsrtm_objective(::Model, ::judiVector{Float32,Array{Float32,2}}, ::judiVector{Float32,Array{Float32,2}}, ::PhysicalParameter{Float32}; options::Options, nlind::Bool) at /Users/francisyin/.julia/dev/JUDI/src/TimeModeling/Modeling/lsrtm_objective_parallel.jl:22 [15] top-level scope at /Users/francisyin/.julia/dev/JUDI/test/MFE.jl:48 [16] include(::String) at ./client.jl:457

in expression starting at /Users/francisyin/.julia/dev/JUDI/test/MFE.jl:48