timholy / Revise.jl

Automatically update function definitions in a running Julia session
https://timholy.github.io/Revise.jl/stable
Other
1.21k stars 110 forks source link

Found `no method matching LoweredCodeUtils.CodeEdges` #840

Closed charleskawczynski closed 1 month ago

charleskawczynski commented 2 months ago

I'm running into:

julia> Revise.retry()
┌ Error: Failed to revise /Users/charliekawczynski/Dropbox/Caltech/work/dev/CliMA/ClimaAtmos.jl/src/cache/cache.jl
│   exception =
│    MethodError: no method matching LoweredCodeUtils.CodeEdges(::Core.CodeInfo)
│    
│    Closest candidates are:
│      LoweredCodeUtils.CodeEdges(::Any, ::Any, ::Any)
│       @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/GYGev/src/codeedges.jl:372
│      LoweredCodeUtils.CodeEdges(::Core.CodeInfo, ::LoweredCodeUtils.CodeLinks)
│       @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/GYGev/src/codeedges.jl:409
│      LoweredCodeUtils.CodeEdges(::Vector{Vector{Int64}}, ::Vector{Vector{Int64}}, ::Dict{GlobalRef, LoweredCodeUtils.Variable})
│       @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/GYGev/src/codeedges.jl:372
│      ...
│    
│    Stacktrace:
│     [1] minimal_evaluation!(predicate::Any, methodinfo::Revise.CodeTrackingMethodInfo, mod::Module, src::Core.CodeInfo, mode::Symbol)
│       @ Revise ~/.julia/packages/Revise/W4D4d/src/lowered.jl:88
└ @ Revise ~/.julia/packages/Revise/W4D4d/src/packagedef.jl:724
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Not sure I can provide an easy mwe, but maybe the stack trace helps?

charleskawczynski commented 1 month ago

Actually, this might work:

# git clone https://github.com/CliMA/ClimaAtmos.jl
# cd ClimaAtmos.jl/
# julia --project=examples

using Revise;
import Thermodynamics as TD
TD.print_warning() = false
import ClimaAtmos as CA;
import ClimaAtmos.InitialConditions as ICs;
import ClimaCore.Spaces

config_dict = Dict();
config_dict["moist"] = "equil";
config_dict["rayleigh_sponge"] = true;
config_dict["edmfx_entr_model"] = "Generalized";
config_dict["implicit_diffusion"] = true;
config_dict["approximate_linear_solve_iters"] = 2;
config_dict["edmfx_sgs_mass_flux"] = true;
config_dict["edmfx_upwinding"] = "first_order";
config_dict["prognostic_tke"] = true;
config_dict["surface_setup"] = "DefaultMoninObukhov";
config_dict["override_τ_precip"] = false;
config_dict["dt"] = "30secs";
config_dict["netcdf_output_at_levels"] = true;
config_dict["t_end"] = "3600secs";
config_dict["insolation"] = "rcemipii";
config_dict["edmfx_sgs_diffusive_flux"] = true;
config_dict["turbconv"] = "diagnostic_edmfx";
config_dict["dt_save_state_to_disk"] = "12hours";
config_dict["ode_algo"] = "ARS343";
config_dict["config"] = "box";
config_dict["netcdf_interpolation_num_points"] = [8, 8, 60];
config_dict["edmfx_nh_pressure"] = true;
config_dict["precip_model"] = "0M";
config_dict["toml"] = ["toml/rcemipii_diagnostic_edmfx_0M.toml"];
config_dict["diagnostics"] = Dict{Any, Any}[Dict("short_name" => ["ts", "ta", "thetaa", "ha", "pfull", "rhoa", "ua", "va", "wa", "hur", "hus", "cl", "clw", "cli", "hussfc", "evspsbl", "pr"], "period" => "5mins"), Dict("short_name" => ["arup", "waup", "taup", "thetaaup", "haup", "husup", "hurup", "clwup", "cliup", "waen", "tke", "lmix"], "period" => "5mins")];
config_dict["surface_temperature"] = "RCEMIPII";
config_dict["edmfx_detr_model"] = "Generalized";
config_dict["rad"] = "allskywithclear";
config = CA.AtmosConfig(config_dict);

# include("examples/hybrid/driver.jl")
import ClimaParams as CP
import YAML
params = CA.create_parameter_set(config)
atmos = CA.get_atmos(config, params)

sim_info = CA.get_sim_info(config)
job_id = sim_info.job_id
output_dir = sim_info.output_dir
@info "Simulation info" job_id output_dir

CP.log_parameter_information(
    config.toml_dict,
    joinpath(output_dir, "$(job_id)_parameters.toml"),
    strict = true,
)
YAML.write_file(joinpath(output_dir, "$job_id.yml"), config.parsed_args)

spaces = CA.get_spaces(config.parsed_args, params, config.comms_ctx)

initial_condition = CA.get_initial_condition(config.parsed_args)
surface_setup = CA.get_surface_setup(config.parsed_args)

Y = ICs.atmos_state(
    initial_condition(params),
    atmos,
    spaces.center_space,
    spaces.face_space,
)
t_start = Spaces.undertype(axes(Y.c))(0)

tracers = CA.get_tracers(config.parsed_args)
@info "About to call build_cache"

@time CA.build_cache(
    Y,
    atmos,
    params,
    surface_setup,
    sim_info,
    tracers.aerosol_names,
)

using JET
@test_opt CA.build_cache(
     Y,
     atmos,
     params,
     surface_setup,
     sim_info,
     tracers.aerosol_names,
)
charleskawczynski commented 1 month ago

I'm running into this a lot...

aviatesk commented 1 month ago

I think you are using old Revise version?

charleskawczynski commented 1 month ago

I was, but I've since updated and I'm still seeing it.

aviatesk commented 1 month ago

Let me know which Revise version you're using?

charleskawczynski commented 1 month ago

Ah, actually, I was on Revise v3.5.15. I just updated, I'll check now if I'm still seeing this.

charleskawczynski commented 1 month ago

Alright, I haven't seen this with the latest release, so I'll close for now.