Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JET failures #107

Open
charleskawczynski opened this issue Sep 10, 2024 · 1 comment
Open

JET failures #107

charleskawczynski opened this issue Sep 10, 2024 · 1 comment
Labels

Comments

@charleskawczynski
Copy link
Member

I recently found some JET failures (including a captured variable) in ClimaAtmos build_cache, which points to TimeVaryingInput:

  │┌ tracer_cache(Y::ClimaCore.Fields.FieldVector{…}, atmos::ClimaAtmos.AtmosModel{…}, prescribe_ozone::Bool, prescribed_aerosol_names::Tuple{}, start_date::Dates.DateTime) @ ClimaAtmos /Users/charliekawczynski/Dropbox/Caltech/work/dev/CliMA/ClimaAtmos.jl/src/cache/tracer_cache.jl:20
  ││┌ kwcall(::@NamedTuple{…}, ::typeof(ClimaUtilities.TimeVaryingInputs.TimeVaryingInput), file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace) @ ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/TimeVaryingInputsExt.jl:142
  │││┌ TimeVaryingInput(file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace; method::ClimaUtilities.TimeVaryingInputs.LinearPeriodFillingInterpolation{…}, reference_date::Dates.DateTime, t_start::Float64, regridder_type::Symbol, regridder_kwargs::Tuple{}, file_reader_kwargs::Tuple{}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/TimeVaryingInputsExt.jl:153
  ││││┌ kwcall(::@NamedTuple{…}, ::typeof(ClimaUtilities.DataHandling.DataHandler), file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace) @ ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/DataHandlingExt.jl:126
  │││││┌ DataHandler(file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace; reference_date::Dates.DateTime, t_start::Float64, regridder_type::Symbol, cache_max_size::Int64, regridder_kwargs::Tuple{}, file_reader_kwargs::Tuple{}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/DataHandlingExt.jl:148
  ││││││┌ NCFileReader(file_path::String, varname::String) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:75
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:92
  ││││││││┌ read_available_dates(ds::NCDatasets.NCDataset) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/nc_common.jl:9
  │││││││││┌ getindex(ds::NCDatasets.NCDataset, varname::String) @ CommonDataModel /Users/charliekawczynski/.julia/packages/CommonDataModel/G3moc/src/dataset.jl:170
  ││││││││││┌ cfvariable(ds::NCDatasets.NCDataset, varname::String) @ CommonDataModel /Users/charliekawczynski/.julia/packages/CommonDataModel/G3moc/src/cfvariable.jl:86
  │││││││││││┌ boundsParentVar(ds::NCDatasets.NCDataset, varname::String) @ NCDatasets /Users/charliekawczynski/.julia/packages/NCDatasets/PkTUf/src/cfvariable.jl:233
  ││││││││││││┌ iterate(::Base.Generator{…} where F<:(NCDatasets.var"#42#45"{…} where {…})) @ Base ./generator.jl:47
  │││││││││││││ runtime dispatch detected: %20::NCDatasets.var"#42#45"{NCDatasets.NCDataset{TDS, Tmaskingvalue}} where {TDS, Tmaskingvalue}(%15::Int32)::NCDatasets.Variable{_A, _B, NCDatasets.NCDataset{TDS, Tmaskingvalue}} where {_A, _B, TDS, Tmaskingvalue}
  ││││││││││││└────────────────────
  │││││││││││┌ boundsParentVar(ds::NCDatasets.NCDataset, varname::String) @ NCDatasets /Users/charliekawczynski/.julia/packages/NCDatasets/PkTUf/src/cfvariable.jl:238
  ││││││││││││┌ iterate(g::Base.Generator{…} where F<:(NCDatasets.var"#42#45"{…} where {…}), s::Int64) @ Base ./generator.jl:47
  │││││││││││││ runtime dispatch detected: %20::NCDatasets.var"#42#45"{NCDatasets.NCDataset{TDS, Tmaskingvalue}} where {TDS, Tmaskingvalue}(%16::Int32)::NCDatasets.Variable{_A, _B, NCDatasets.NCDataset{TDS, Tmaskingvalue}} where {_A, _B, TDS, Tmaskingvalue}
  ││││││││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:92
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.read_available_dates(%90::NCDatasets.NCDataset)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:96
  ││││││││ runtime dispatch detected: (%90::NCDatasets.NCDataset)[varname::String]::CommonDataModel.CFVariable{…} where {…}
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:96
  ││││││││ runtime dispatch detected: dimnames(%95::CommonDataModel.CFVariable{…} where {…})::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:98
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.isempty(%94::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:98
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.:!(%97::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:101
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.findall(#2, %96::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:102
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.length(%100::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:102
  ││││││││ runtime dispatch detected: (%101::Any ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.:(==) 1)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:104
  ││││││││ runtime dispatch detected: (%100::Any)[]::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:106
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.issorted(%94::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:111
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.filter(!ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.var"#2#5"(), %96::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:114
  ││││││││ runtime dispatch detected: Base.Generator(%120::ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.var"#3#6"{NCDatasets.NCDataset{…}} where {TDS, Tmaskingvalue}, %116::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:114
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.all(%121::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:115
  ││││││││ runtime dispatch detected: Base.Generator(%126::ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.var"#4#7"{NCDatasets.NCDataset{…}} where {TDS, Tmaskingvalue}, %116::Any)::Any
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:115
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.Tuple(%127::Any)::Tuple
  │││││││└────────────────────
  │││││││┌ NCFileReader(file_path::String, varname::String; preprocess_func::typeof(identity), cache_max_size::Int64) @ ClimaUtilitiesNCDatasetsExt.NCFileReaderExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/NCFileReaderExt.jl:126
  ││││││││ runtime dispatch detected: ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.NCFileReader(file_path::String, varname::String, %128::Tuple, %94::Any, %90::NCDatasets.NCDataset, preprocess_func::typeof(identity), %131::ClimaUtilities.DataStructures.LRUCache{Dates.DateTime, Array}, %117::Any)::ClimaUtilitiesNCDatasetsExt.NCFileReaderExt.NCFileReader{…} where {…}
  │││││││└────────────────────
  │││││┌ DataHandler(file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace; reference_date::Dates.DateTime, t_start::Float64, regridder_type::Symbol, cache_max_size::Int64, regridder_kwargs::Tuple{}, file_reader_kwargs::Tuple{}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/DataHandlingExt.jl:162
  ││││││┌ mktempdir() @ Base.Filesystem ./file.jl:699
  │││││││┌ mktempdir(parent::String) @ Base.Filesystem ./file.jl:699
  ││││││││┌ mktempdir(parent::String; prefix::String, cleanup::Bool) @ Base.Filesystem ./file.jl:719
  │││││││││┌ temp_cleanup_later(path::String) @ Base.Filesystem ./file.jl:523
  ││││││││││┌ temp_cleanup_later(path::String; asap::Bool) @ Base.Filesystem ./file.jl:530
  │││││││││││┌ temp_cleanup_purge() @ Base.Filesystem ./file.jl:537
  ││││││││││││┌ temp_cleanup_purge(; force::Bool) @ Base.Filesystem ./file.jl:544
  │││││││││││││┌ prepare_for_deletion(path::String) @ Base.Filesystem ./file.jl:509
  ││││││││││││││┌ kwcall(::@NamedTuple{onerror::Base.Filesystem.var"#16#17"}, ::typeof(walkdir), root::String) @ Base.Filesystem ./file.jl:934
  │││││││││││││││┌ walkdir(root::String; topdown::Bool, follow_symlinks::Bool, onerror::Base.Filesystem.var"#16#17") @ Base.Filesystem ./file.jl:973
  ││││││││││││││││┌ Channel{Tuple{String, Vector{String}, Vector{String}}}(func::Base.Filesystem.var"#28#31"{String}) @ Base ./channels.jl:140
  │││││││││││││││││┌ Channel{Tuple{String, Vector{String}, Vector{String}}}(func::Base.Filesystem.var"#28#31"{String}, size::Int64) @ Base ./channels.jl:140
  ││││││││││││││││││┌ Channel{…}(func::Base.Filesystem.var"#28#31"{…}, size::Int64; taskref::Nothing, spawn::Bool, threadpool::Nothing) @ Base ./channels.jl:142
  │││││││││││││││││││┌ Task(f::Base.var"#651#652"{Base.Filesystem.var"#28#31"{String}, Channel{Tuple{String, Vector{String}, Vector{String}}}}) @ Base ./task.jl:5
  ││││││││││││││││││││┌ (::Base.var"#651#652"{Base.Filesystem.var"#28#31"{String}, Channel{Tuple{String, Vector{String}, Vector{String}}}})() @ Base ./channels.jl:142
  │││││││││││││││││││││┌ (::Base.Filesystem.var"#28#31"{String})(chnl::Channel{Tuple{String, Vector{String}, Vector{String}}}) @ Base.Filesystem ./file.jl:973
  ││││││││││││││││││││││ runtime dispatch detected: %6::Any(chnl::Channel{Tuple{String, Vector{String}, Vector{String}}}, %7::String)::Any
  │││││││││││││││││││││└────────────────────
  │││││││││││││││┌ walkdir(root::String; topdown::Bool, follow_symlinks::Bool, onerror::Base.Filesystem.var"#16#17") @ Base.Filesystem ./file.jl:935
  ││││││││││││││││ captured variable `_walkdir` detected
  │││││││││││││││└────────────────────
  │││││┌ DataHandler(file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace; reference_date::Dates.DateTime, t_start::Float64, regridder_type::Symbol, cache_max_size::Int64, regridder_kwargs::Tuple{}, file_reader_kwargs::Tuple{}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/DataHandlingExt.jl:165
  ││││││┌ merge(a::@NamedTuple{regrid_dir::String}, itr::Tuple{}) @ Base ./namedtuple.jl:372
  │││││││┌ merge(a::@NamedTuple{regrid_dir::String}, b::NamedTuple) @ Base ./namedtuple.jl:331
  ││││││││┌ merge_fallback(a::@NamedTuple{regrid_dir::String}, b::NamedTuple, an::Tuple{Symbol}, bn::Tuple{Vararg{Symbol}}) @ Base ./namedtuple.jl:294
  │││││││││ runtime dispatch detected: Base.sym_in(%68::Symbol, bn::Tuple{Vararg{Symbol}})::Bool
  ││││││││└────────────────────
  ││││││┌ merge(a::@NamedTuple{regrid_dir::String}, itr::Tuple{}) @ Base ./namedtuple.jl:372
  │││││││ runtime dispatch detected: merge(a::@NamedTuple{regrid_dir::String}, %8::NamedTuple)::NamedTuple
  ││││││└────────────────────
  │││┌ TimeVaryingInput(file_path::String, varname::String, target_space::ClimaCore.Spaces.AbstractSpace; method::ClimaUtilities.TimeVaryingInputs.LinearPeriodFillingInterpolation{…}, reference_date::Dates.DateTime, t_start::Float64, regridder_type::Symbol, regridder_kwargs::Tuple{}, file_reader_kwargs::Tuple{}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/TimeVaryingInputsExt.jl:170
  ││││┌ kwcall(::NamedTuple{…}, ::typeof(ClimaUtilities.TimeVaryingInputs.TimeVaryingInput), data_handler::ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt.DataHandler{…} where {…}) @ ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/TimeVaryingInputsExt.jl:116
  │││││┌ TimeVaryingInput(data_handler::ClimaUtilitiesClimaCoreNCDatasetsExt.DataHandlingExt.DataHandler{…} where {…}; method::ClimaUtilities.TimeVaryingInputs.LinearPeriodFillingInterpolation{…}, context::Any) @ ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt /Users/charliekawczynski/.julia/packages/ClimaUtilities/iHyHf/ext/TimeVaryingInputsExt.jl:125
  ││││││┌ lastindex(A::RecursiveArrayTools.ArrayPartition{<:AbstractFloat}) @ RecursiveArrayTools /Users/charliekawczynski/.julia/packages/RecursiveArrayTools/xGKIm/src/array_partition.jl:216
  │││││││┌ length(A::RecursiveArrayTools.ArrayPartition{<:AbstractFloat}) @ RecursiveArrayTools /Users/charliekawczynski/.julia/packages/RecursiveArrayTools/xGKIm/src/array_partition.jl:292
  ││││││││┌ broadcast(::typeof(length), ::Tuple) @ Base.Broadcast ./broadcast.jl:845
  │││││││││ runtime dispatch detected: Base.Broadcast.map(length, t::Tuple)::Any
  ││││││││└────────────────────
  ││││││┌ lastindex(A::RecursiveArrayTools.ArrayPartition{<:AbstractFloat}) @ RecursiveArrayTools /Users/charliekawczynski/.julia/packages/RecursiveArrayTools/xGKIm/src/array_partition.jl:216
  │││││││ runtime dispatch detected: RecursiveArrayTools.length(A::RecursiveArrayTools.ArrayPartition{<:AbstractFloat})::Any
  ││││││└────────────────────
  │┌ tracer_cache(Y::ClimaCore.Fields.FieldVector{…}, atmos::ClimaAtmos.AtmosModel{…}, prescribe_ozone::Bool, prescribed_aerosol_names::Tuple{}, start_date::Dates.DateTime) @ ClimaAtmos /Users/charliekawczynski/Dropbox/Caltech/work/dev/CliMA/ClimaAtmos.jl/src/cache/tracer_cache.jl:13
  ││ captured variable `target_space` detected
  │└────────────────────
  │┌ tracer_cache(Y::ClimaCore.Fields.FieldVector{…}, atmos::ClimaAtmos.AtmosModel{…}, prescribe_ozone::Bool, prescribed_aerosol_names::Tuple{}, start_date::Dates.DateTime) @ ClimaAtmos /Users/charliekawczynski/Dropbox/Caltech/work/dev/CliMA/ClimaAtmos.jl/src/cache/tracer_cache.jl:20
  ││ runtime dispatch detected: Core.kwcall(%33::@NamedTuple{…}, ClimaAtmos.TimeVaryingInput, %32::String, "vmro3", %7::ClimaCore.Spaces.ExtrudedFiniteDifferenceSpace{…})::ClimaUtilitiesClimaCoreNCDatasetsExt.TimeVaryingInputsExt.InterpolatingTimeVaryingInput23D{…} where {…}
  │└────────────────────

Can we make this type stable to reduce the JET noise? (and perhaps add some JET tests)

@Sbozzolo
Copy link
Member

Sbozzolo commented Sep 10, 2024

There's definetely room to improve type stability in multiple components of this package. For the ones you report here, that's not easy because NCDatasets itself is not type stable (Alexander-Barth/NCDatasets.jl#251). Also, the captured variable _walkdir is in Base.Filesystem so maybe you should also open an issue in julia if it is not already there. (mktmpdir is used when we deal with ClimaCoreTempestRegridder.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants