JuliaSparse / SuiteSparseGraphBLAS.jl

Sparse, General Linear Algebra for Graphs!
MIT License
103 stars 17 forks source link

`using SuiteSparseGraphBLAS` results in failed precompilation #37

Closed thazhemadam closed 3 years ago

thazhemadam commented 3 years ago

Adding using SuiteSparseGraphBLAS to wherever required in another package results in failed precompilation of the other package.

Here's an example, where I'm adding the using statement to the file src/features/orbitalfeature.jl in the package ChemistryFeaturization.jl.

(ChemistryFeaturization) pkg> precompile
Precompiling project...
  ✗ ChemistryFeaturization
  0 dependencies successfully precompiled in 20 seconds (91 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

ChemistryFeaturization [6c925690-434a-421d-aea7-51398c5b007a]

Failed to precompile ChemistryFeaturization [6c925690-434a-421d-aea7-51398c5b007a] to /home/zephyr/.julia/compiled/v1.6/ChemistryFeaturization/jl_Dl8Va8.
ERROR: LoadError: LoadError: LoadError: InitError: Evaluation into the closed module `SelectOps` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `SelectOps` with `eval` during precompilation - don't do this.
Stacktrace:
  [1] eval
    @ ./boot.jl:360 [inlined]
  [2] _loadselectops()
    @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/NCSUH/src/operators/selectops.jl:49
  [3] __init__()
    @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/NCSUH/src/SuiteSparseGraphBLAS.jl:114
  [4] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:696
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:782
  [6] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1020
  [7] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:936
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:923
  [9] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [10] include(x::String)
    @ ChemistryFeaturization.FeatureDescriptor ~/Chemellia/ChemistryFeaturization.jl/src/features/features.jl:1
 [11] top-level scope
    @ ~/Chemellia/ChemistryFeaturization.jl/src/features/features.jl:46
 [12] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [13] include(x::String)
    @ ChemistryFeaturization ~/Chemellia/ChemistryFeaturization.jl/src/ChemistryFeaturization.jl:1
 [14] top-level scope
    @ ~/Chemellia/ChemistryFeaturization.jl/src/ChemistryFeaturization.jl:22
 [15] include
    @ ./Base.jl:386 [inlined]
 [16] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1235
 [17] top-level scope
    @ none:1
 [18] eval
    @ ./boot.jl:360 [inlined]
 [19] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [20] top-level scope
    @ none:1
during initialization of module SuiteSparseGraphBLAS
in expression starting at /home/zephyr/Chemellia/ChemistryFeaturization.jl/src/features/orbitalfeature.jl:10
in expression starting at /home/zephyr/Chemellia/ChemistryFeaturization.jl/src/features/features.jl:1
in expression starting at /home/zephyr/Chemellia/ChemistryFeaturization.jl/src/ChemistryFeaturization.jl:1
rayegun commented 3 years ago

This occurs because of the way built in operators are generated. They are all Cglobals, and currently generated from lists of strings by eval in the main module.

A couple options:

These shouldn't really be exposed to users either, so moving them into libgb is likely best. This will come with 1.0 although it will probably delay it by a day or so.

Apologies! I've only used it from the REPL so far where this error didn't show.

rayegun commented 3 years ago

Fixed on master by removing all evals from init.