Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CoolPDLP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using SparseArrays: SparseArrays, SparseMatrixCSC, AbstractSparseMatrix, findnz,

include("public.jl")

@stable begin
@stable default_mode = "warn" begin
include("utils/device.jl")
include("utils/mat_coo.jl")
include("utils/mat_csr.jl")
Expand Down
9 changes: 9 additions & 0 deletions src/utils/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ function random_milp_and_sol(m::Int, n::Int, p::Float64)
y = proj_multiplier.(randn(m), lc, uc)
return MILP(; c, lv, uv, A, lc, uc, int_var), PrimalDualSolution(x, y)
end

# to test DispatchDoctor preference activation
function _unstable_relu(x)
if x > 0
return x
else
return 0.0
end
end
8 changes: 6 additions & 2 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
CoolPDLP = "9e90bdc5-3073-4e0f-a275-e19f28ac1b53"
DispatchDoctor = "8d63f2c5-f18a-4cf2-ba9d-b3f60fc568c8"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
Expand All @@ -13,15 +14,18 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptBenchmarkInstances = "f7f8d0a1-fd34-491e-a7ac-a4cf52f91fe5"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
CoolPDLP = {path = ".."}
CoolPDLP = { path = ".." }

[compat]
Aqua = "0.8.14"
Test = "1"

[preferences.CoolPDLP]
dispatch_doctor_default_codegen_level = "min"
dispatch_doctor_mode = "error"
3 changes: 0 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Pkg
using Test
using Preferences: set_preferences!
# see https://github.com/MilesCranmer/DispatchDoctor.jl?tab=readme-ov-file#-usage-in-packages
set_preferences!("CoolPDLP", "default_codegen_level" => "min")

GROUP = get(ENV, "COOLPDLP_TEST_GROUP", nothing)

Expand Down
6 changes: 6 additions & 0 deletions test/utils/test.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using CoolPDLP
using DispatchDoctor
using Test

@test CoolPDLP._unstable_relu(1.0) == 1.0
@test_throws DispatchDoctor.TypeInstabilityError CoolPDLP._unstable_relu(0)
Loading