bsc-quantic / Extrae.jl

Julia bindings for extrae Basic API
Apache License 2.0
6 stars 0 forks source link

Error: no method matching `namemap` when tracing COBREXA #16

Open clasqui opened 1 year ago

clasqui commented 1 year ago

Case

Trying to trace COBREXA quick start guide. To reproduce, start julia with the environment for extrae using Extrae.jl/scripts/env.sh julia quick-start.jl. The script run consists of the following:

using Distributed
using Extrae
using Cassette

addprocs_extrae(2)
@everywhere using COBREXA, GLPK

model = load_model("e_coli_core.xml")
function main()
    result = flux_variability_analysis(model, GLPK.Optimizer; workers=workers())
end

Cassette.overdub(Extrae.ExtraeCtx(), main)
@everywhere Extrae.finish()

Error

After extrae is initialized and the overdubbing of the main function starts, the following error appears:

LoadError: MethodError: no method matching namemap(::Type{MathOptInterface.ActivationCondition})
The applicable method may be too new: running in world age 29672, while current world is 29803.
Closest candidates are:
  namemap(::Type{MathOptInterface.ActivationCondition}) at Enums.jl:201 (method too new to be called from this world context.)
  namemap(::Type{MathOptInterface.BasisStatusCode}) at Enums.jl:201 (method too new to be called from this world context.)
  namemap(::Type{HDF5.API.H5F_mem_t}) at Enums.jl:201 (method too new to be called from this world context.)

I attatch the whole output with the stacktrace here: cobrexa-trace.log

mofeing commented 1 year ago

@clasqui mmm could you import COBREXA addprocs_extrae? I know you can't for the distributed workers but can you at least in the master?

clasqui commented 1 year ago

@mofeing I don't understand your question. I can import the COBREXA package both in master and in workers (line 6 of the example, using the @everywhere clause). The problem appears in the line Cassette.overdub(Extrae.ExtraeCtx(), main), when Cassette starts overdubbing the whole tree of calls of the COBREXA code.

mofeing commented 1 year ago

In Julia, when a function is compiled it gets a timestamp assigned (i.e. the world age). This is done because due to the possibility of compilation and execution of code at the same time using @eval. What if you're redefining the function you're currently running in?

This is what the world age avoids: it avoids running code newer than the current executing world age when there have been 2 compilations for the same function.

I'm trying to figure it why it affects the namemap function specifically. 🤔

mofeing commented 1 year ago

@clasqui could you try running main once without Cassette and then with Cassette?

using Distributed
using Extrae
using Cassette

addprocs_extrae(2)
@everywhere using COBREXA, GLPK

model = load_model("e_coli_core.xml")
function main()
    result = flux_variability_analysis(model, GLPK.Optimizer; workers=workers())
end

# warmup
main()

Cassette.overdub(Extrae.ExtraeCtx(), main)
@everywhere Extrae.finish()
clasqui commented 1 year ago

@mofeing No luck... first one is executed correctly. Then when it tries to overdub the function, the error raises. It happens always in the same function. Can we force precompiling or something like this of the overdbub?

mofeing commented 1 year ago

mmm I don't think so with Cassette but maybe yeah with CassetteOverlay.jl, but its still experimental. I would first try luck on Julia's Slack, maybe in the #general or #helpdesk channels. Maybe even in #autodiff.