JuliaDiff / SparseDiffTools.jl

Fast jacobian computation through sparsity exploitation and matrix coloring
MIT License
237 stars 41 forks source link

needs comprehensive testing #219

Closed vpuri3 closed 1 year ago

vpuri3 commented 1 year ago

@ChrisRackauckas looks like SparseDiffTools needs more comprehensive testing. I am still getting arrayinerface errors with 1.9 on my personal machine that are not captured by the CI.

Originally posted by @vpuri3 in https://github.com/JuliaDiff/SparseDiffTools.jl/issues/218#issuecomment-1459129150

vpuri3 commented 1 year ago

on master:

SparseDiffTools on  master is 📦 v2.00.0 via ஃ v1.8.5
❯ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
julia> versioninfo()
Julia Version 1.9.0-rc1
Commit 3b2e0d8fbc1 (2023-03-07 07:51 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.4.0)
  CPU: 8 × Apple M2
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 8 on 4 virtual cores
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 8
  JULIA_DEPOT_PATH = /Users/vp/.julia
  JULIA_NUM_THREADS = 8

julia> using SparseDiffTools
[ Info: Precompiling SparseDiffTools [47a9eef4-7e08-11e9-0b38-333d64bd3804]

julia> pkgversion(SparseDiffTools)
v"2.0.0"

(SparseDiffTools) pkg> test
AD using colorvec vector: Error During Test at /Users/vp/.julia/packages/SafeTestsets/A83
XK/src/SafeTestsets.jl:25                                                                
  Got exception outside of a @test          
  LoadError: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{t
ypeof(Main.var"##297".staticf), Float64}, Float64, 3})

  Closest candidates are:                                                                
    (::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat                           
     @ Base rounding.jl:207                 
    (::Type{T})(::T) where T<:Number                                                     
     @ Core boot.jl:792                     
    (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number}
     @ Base char.jl:50                                                                   
    ...       

  Stacktrace:                                                                            
    [1] convert(#unused#::Type{Float64}, x::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.
var"##297".staticf), Float64}, Float64, 3})                                              
      @ Base ./number.jl:7                                                               
    [2] macro expansion                     
      @ ~/.julia/packages/StaticArraysCore/U2Z1K/src/StaticArraysCore.jl:81 [inlined]    
    [3] convert_ntuple                                                                   
      @ ~/.julia/packages/StaticArraysCore/U2Z1K/src/StaticArraysCore.jl:77 [inlined]    
    [4] StaticArraysCore.SVector{30, Float64}(x::NTuple{30, ForwardDiff.Dual{ForwardDiff.
Tag{typeof(Main.var"##297".staticf), Float64}, Float64, 3}})                             
      @ StaticArraysCore ~/.julia/packages/StaticArraysCore/U2Z1K/src/StaticArraysCore.jl
:113                                        
    [5] SArray                                                                           
      @ ~/.julia/packages/StaticArraysCore/U2Z1K/src/StaticArraysCore.jl:117 [inlined]
    [6] StaticArray
      @ ~/.julia/packages/StaticArrays/pTgFe/src/convert.jl:167 [inlined]
    [7] restructure(x::StaticArraysCore.SVector{30, Float64}, y::StaticArraysCore.SVector
{30, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.var"##297".staticf), Float64}, Float64,
 3}})
      @ ArrayInterfaceStaticArraysCoreExt ~/.julia/packages/ArrayInterface/Yjtg5/ext/Arra
yInterfaceStaticArraysCoreExt.jl:34
    [8] SparseDiffTools.ForwardColorJacCache(f::typeof(Main.var"##297".staticf), x::Stati
cArraysCore.SVector{30, Float64}, _chunksize::Nothing; dx::StaticArraysCore.SVector{30, F
loat64}, tag::Nothing, colorvec::Vector{Int64}, sparsity::SparseArrays.SparseMatrixCSC{Fl
oat64, Int64})
      @ SparseDiffTools ~/.julia/dev/SparseDiffTools/src/differentiation/compute_jacobian
_ad.jl:47
    [9] ForwardColorJacCache
      @ ~/.julia/dev/SparseDiffTools/src/differentiation/compute_jacobian_ad.jl:22 [inlin
ed]
   [10] forwarddiff_color_jacobian(f::typeof(Main.var"##297".staticf), x::StaticArraysCor
e.SVector{30, Float64}; colorvec::Vector{Int64}, sparsity::SparseArrays.SparseMatrixCSC{F
loat64, Int64}, jac_prototype::StaticArraysCore.SMatrix{30, 30, Float64, 900}, chunksize:
:Nothing, dx::StaticArraysCore.SVector{30, Float64})
      @ SparseDiffTools ~/.julia/dev/SparseDiffTools/src/differentiation/compute_jacobian
_ad.jl:131
   [11] top-level scope
      @ ~/.julia/dev/SparseDiffTools/test/test_ad.jl:142