JuliaLinearAlgebra / Octavian.jl

Multi-threaded BLAS-like library that provides pure Julia matrix multiplication
https://julialinearalgebra.github.io/Octavian.jl/stable/
Other
226 stars 18 forks source link

switch to SnoopPrecompile.jl #164

Closed ranocha closed 1 year ago

ranocha commented 1 year ago

I basically followed the recipe of https://timholy.github.io/SnoopCompile.jl/dev/snoop_pc.

Not necessarily related to this PR: Do you know why we get so much compilation (and recompilation!) when using Octavian? With this branch on Julia v1.8.3, I get

julia> @time_imports using Octavian
      0.2 ms  Requires
      3.2 ms  ArrayInterfaceCore
      0.1 ms  IfElse
     30.8 ms  Static
      0.5 ms  Compat
      3.8 ms  ArrayInterface
      0.2 ms  Adapt
     57.6 ms  OffsetArrays
      0.6 ms  ArrayInterfaceOffsetArrays
      2.3 ms  StaticArraysCore
    514.4 ms  StaticArrays
      0.3 ms  ArrayInterfaceStaticArraysCore
      0.9 ms  ArrayInterfaceStaticArrays
      0.1 ms  SIMDTypes
      1.2 ms  ManualMemory
      2.8 ms  LayoutPointers
      0.7 ms  CpuId
    159.3 ms  CPUSummary 92.99% compilation time
      0.1 ms  BitTwiddlingConvenienceFunctions
    102.4 ms  HostCPUFeatures 62.49% compilation time
    400.0 ms  VectorizationBase
      3.5 ms  SLEEFPirates
      0.1 ms  UnPack
     41.9 ms  ThreadingUtilities 79.41% compilation time
     15.3 ms  PolyesterWeave 72.52% compilation time
      2.2 ms  DocStringExtensions 59.50% compilation time
      3.2 ms  CloseOpenIntervals
      0.1 ms  SnoopPrecompile
     63.2 ms  ChainRulesCore
      4.7 ms  IrrationalConstants
      0.6 ms  DiffRules
      1.9 ms  DiffResults
     19.4 ms  Preferences
      0.1 ms  OpenLibm_jll
      0.2 ms  NaNMath
     10.7 ms  ChangesOfVariables
      1.3 ms  InverseFunctions
      0.6 ms  LogExpFunctions
      0.2 ms  JLLWrappers
      0.3 ms  CompilerSupportLibraries_jll
      2.1 ms  OpenSpecFun_jll 84.61% compilation time
     13.8 ms  SpecialFunctions
     32.0 ms  MacroTools
      0.2 ms  CommonSubexpressions
    134.6 ms  ForwardDiff
      3.2 ms  SIMDDualNumbers
    199.0 ms  LoopVectorization
   4687.4 ms  Octavian 88.09% compilation time (55% recompilation)

after everything has been precompiled. It seems to get better with Julia v1.9.0-beta2, so there is no need to dig too deep if there is no obvious answer for you.

ranocha commented 1 year ago

This is Octavian.jl from this branch with CPUSummary v0.2.1 but on Julia v1.8.3

ranocha commented 1 year ago

Julia v1.9.0-beta2 yields

julia> @time_imports using Octavian
      0.3 ms  Requires
      0.2 ms  SuiteSparse
      2.1 ms  ArrayInterfaceCore
      0.1 ms  IfElse
     34.7 ms  Static
      0.2 ms  Compat
      4.4 ms  ArrayInterface
      0.3 ms  Adapt
     44.6 ms  OffsetArrays
      0.6 ms  ArrayInterfaceOffsetArrays
      1.0 ms  Statistics
      2.6 ms  StaticArraysCore
    456.8 ms  StaticArrays
      0.3 ms  ArrayInterfaceStaticArraysCore
      1.0 ms  ArrayInterfaceStaticArrays
      0.1 ms  SIMDTypes
      1.3 ms  ManualMemory
     10.5 ms  LayoutPointers
      0.7 ms  CpuId
    102.6 ms  CPUSummary 97.78% compilation time
      0.2 ms  BitTwiddlingConvenienceFunctions
     12.0 ms  HostCPUFeatures
    361.9 ms  VectorizationBase
      3.1 ms  SLEEFPirates
      0.1 ms  UnPack
      7.4 ms  ThreadingUtilities
      4.3 ms  PolyesterWeave
      1.3 ms  DocStringExtensions
      2.9 ms  CloseOpenIntervals
      0.1 ms  SnoopPrecompile
     69.5 ms  ChainRulesCore
      5.0 ms  IrrationalConstants
      0.5 ms  DiffRules
      1.8 ms  DiffResults
     17.6 ms  Preferences
      0.2 ms  OpenLibm_jll
      0.2 ms  NaNMath
      0.8 ms  ChangesOfVariables
      0.9 ms  InverseFunctions
      0.5 ms  LogExpFunctions
      0.2 ms  JLLWrappers
      3.0 ms  OpenSpecFun_jll 86.22% compilation time
     14.8 ms  SpecialFunctions
     14.2 ms  MacroTools
      0.4 ms  CommonSubexpressions
    106.4 ms  ForwardDiff
      3.0 ms  SIMDDualNumbers
    180.0 ms  LoopVectorization
    649.4 ms  Octavian 24.69% compilation time

on Octavian master

codecov[bot] commented 1 year ago

Codecov Report

Base: 86.64% // Head: 86.44% // Decreases project coverage by -0.19% :warning:

Coverage data is based on head (af0174d) compared to base (5c30e4a). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #164 +/- ## ========================================== - Coverage 86.64% 86.44% -0.20% ========================================== Files 13 13 Lines 1003 1003 ========================================== - Hits 869 867 -2 - Misses 134 136 +2 ``` | [Impacted Files](https://codecov.io/gh/JuliaLinearAlgebra/Octavian.jl/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra) | Coverage Δ | | |---|---|---| | [src/Octavian.jl](https://codecov.io/gh/JuliaLinearAlgebra/Octavian.jl/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL09jdGF2aWFuLmps) | `50.00% <ø> (ø)` | | | [src/matmul.jl](https://codecov.io/gh/JuliaLinearAlgebra/Octavian.jl/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL21hdG11bC5qbA==) | `92.52% <0.00%> (-0.56%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.