Skip to content

Commit 339d769

Browse files
authored
Remove precompile statements (#2643)
1 parent 7f26868 commit 339d769

File tree

9 files changed

+15
-245
lines changed

9 files changed

+15
-245
lines changed

src/Bridges/Bridges.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ MOI.is_copyable(::ListOfNonstandardBridges) = false
142142

143143
MOI.get_fallback(model::MOI.ModelLike, ::ListOfNonstandardBridges) = Type[]
144144

145-
include("precompile.jl")
146-
147145
function _test_structural_identical(
148146
a::MOI.ModelLike,
149147
b::MOI.ModelLike;

src/Bridges/precompile.jl

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/MathOptInterface.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ include("FileFormats/FileFormats.jl")
376376

377377
include("instantiate.jl")
378378

379-
_precompile_()
380-
381379
"""
382380
IndexMap()
383381

src/Nonlinear/ReverseAD/ReverseAD.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,4 @@ include("reverse_mode.jl")
3939
include("forward_over_reverse.jl")
4040
include("mathoptinterface_api.jl")
4141

42-
include("precompile.jl")
43-
4442
end # module

src/Nonlinear/ReverseAD/precompile.jl

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/Utilities/Utilities.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,4 @@ include("set_dot.jl")
7272

7373
include("distance_to_set.jl")
7474

75-
include("precompile.jl")
76-
_precompile_()
77-
7875
end # module

src/Utilities/precompile.jl

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/precompile.jl

Lines changed: 6 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,16 @@
55
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
66

77
function precompile_constraint(model, F, S)
8-
Base.precompile(get, (model, ListOfConstraintIndices{F,S}))
9-
Base.precompile(get, (model, ListOfConstraintAttributesSet{F,S}))
10-
Base.precompile(get, (model, ConstraintSet, ConstraintIndex{F,S}))
11-
Base.precompile(get, (model, ConstraintSet, Vector{ConstraintIndex{F,S}}))
12-
Base.precompile(set, (model, ConstraintSet, ConstraintIndex{F,S}, S))
13-
14-
Base.precompile(get, (model, ConstraintFunction, ConstraintIndex{F,S}))
15-
Base.precompile(set, (model, ConstraintFunction, ConstraintIndex{F,S}, F))
16-
Base.precompile(
17-
get,
18-
(model, ConstraintFunction, Vector{ConstraintIndex{F,S}}),
19-
)
20-
21-
Base.precompile(get, (model, ConstraintDual, ConstraintIndex{F,S}))
22-
Base.precompile(get, (model, ConstraintPrimal, ConstraintIndex{F,S}))
23-
24-
Base.precompile(
25-
get,
26-
(model, AbstractConstraintAttribute, ConstraintIndex{F,S}),
27-
)
28-
Base.precompile(
29-
get,
30-
(model, AbstractConstraintAttribute, Vector{ConstraintIndex{F,S}}),
31-
)
32-
33-
Base.precompile(add_constraint, (model, F, S))
34-
Base.precompile(add_constraints, (model, Vector{F}, Vector{S}))
35-
Base.precompile(delete, (model, ConstraintIndex{F,S}))
36-
Base.precompile(is_valid, (model, ConstraintIndex{F,S}))
37-
Base.precompile(get, (model, ConstraintName, ConstraintIndex{F,S}))
38-
return Base.precompile(
39-
set,
40-
(model, ConstraintName, ConstraintIndex{F,S}, String),
41-
)
8+
@warn("This function is deprecated. Use PrecompileTools.jl instead")
9+
return
4210
end
4311

4412
function precompile_variables(model)
45-
Base.precompile(delete, (model, VariableIndex))
46-
Base.precompile(delete, (model, Vector{VariableIndex}))
47-
Base.precompile(get, (model, AbstractVariableAttribute, VariableIndex))
48-
Base.precompile(
49-
get,
50-
(model, AbstractVariableAttribute, Vector{VariableIndex}),
51-
)
52-
Base.precompile(get, (model, VariableName, VariableIndex))
53-
Base.precompile(set, (model, VariableName, VariableIndex, String))
54-
Base.precompile(get, (model, VariablePrimalStart, VariableIndex))
55-
Base.precompile(set, (model, VariablePrimalStart, VariableIndex, Float64))
56-
Base.precompile(get, (model, VariablePrimalStart, Vector{VariableIndex}))
57-
Base.precompile(
58-
set,
59-
(model, VariablePrimalStart, Vector{VariableIndex}, Vector{Float64}),
60-
)
61-
Base.precompile(get, (model, VariablePrimal, VariableIndex))
62-
Base.precompile(get, (model, VariablePrimal, Vector{VariableIndex}))
63-
return Base.precompile(add_constrained_variables, (model, Reals))
13+
@warn("This function is deprecated. Use PrecompileTools.jl instead")
14+
return
6415
end
6516

6617
function precompile_model(model, constraints)
67-
Base.precompile(empty!, (model,))
68-
Base.precompile(is_empty, (model,))
69-
Base.precompile(get, (model, ListOfConstraintTypesPresent))
70-
Base.precompile(optimize!, (model,))
71-
Base.precompile(add_variable, (model,))
72-
Base.precompile(add_variables, (model, Int))
73-
for attr in (
74-
ListOfVariableIndices,
75-
ListOfVariableAttributesSet,
76-
TerminationStatus,
77-
DualStatus,
78-
PrimalStatus,
79-
ObjectiveValue,
80-
Silent,
81-
TimeLimitSec,
82-
NumberOfVariables,
83-
)
84-
Base.precompile(get, (model, attr))
85-
end
86-
87-
precompile_variables(model)
88-
for (F, S) in constraints
89-
precompile_constraint(model, F, S)
90-
end
91-
return Base.precompile(Tuple{typeof(add_constrained_variables),model,Reals})
92-
end
93-
94-
function _precompile_()
95-
return Base.precompile(
96-
Tuple{
97-
Core.kwftype(typeof(instantiate)),
98-
NamedTuple{(:with_bridge_type,),Tuple{DataType}},
99-
typeof(instantiate),
100-
Type,
101-
},
102-
) # time: 0.481656
18+
@warn("This function is deprecated. Use PrecompileTools.jl instead")
19+
return
10320
end

test/errors.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,15 @@ function test_isvalid_fallback()
396396
return
397397
end
398398

399+
function test_logs_precompile()
400+
model = MOI.Utilities.Model{Float64}()
401+
F, S = MOI.VariableIndex, MOI.ZeroOne
402+
@test_logs (:warn,) MOI.precompile_constraint(model, F, S)
403+
@test_logs (:warn,) MOI.precompile_variables(model)
404+
@test_logs (:warn,) MOI.precompile_model(model, [(F, S)])
405+
return
406+
end
407+
399408
end # module
400409

401410
TestErrors.runtests()

0 commit comments

Comments
 (0)