|
1 | | -export amgb, Geometry, Convex, convex_linear, convex_Euclidian_power, AMGBConvergenceFailure, apply_D, linesearch_illinois, linesearch_backtracking, stopping_exact, stopping_inexact, interpolate, intersect, plot, Log, default_idx, multigrid_from_fine_grid, map_rows, map_rows_gpu, amgb_assert_uniform |
| 1 | +export amgb, Geometry, Convex, convex_linear, convex_Euclidian_power, AMGBConvergenceFailure, apply_D, linesearch_illinois, linesearch_backtracking, stopping_exact, stopping_inexact, interpolate, intersect, plot, Log, default_idx, multigrid_from_fine_grid, map_rows, map_rows_gpu |
2 | 2 |
|
3 | 3 | @doc raw""" |
4 | 4 | Log(x::T) where {T} = x<=0 ? T(-Inf) : Base.log(x) # "Convex programmer's log" |
@@ -79,10 +79,6 @@ amgb_zeros(::LinearAlgebra.Adjoint{T, Matrix{T}},m,n) where {T} = zeros(T,m,n) |
79 | 79 | amgb_zeros(::Type{Vector{T}}, m) where {T} = zeros(T, m) |
80 | 80 | amgb_all_isfinite(z::Vector{T}) where {T} = all(isfinite.(z)) |
81 | 81 |
|
82 | | -# Assert that a value is uniform across all MPI ranks (no-op for non-MPI) |
83 | | -# Override in MultiGridBarrierMPI to actually check uniformity |
84 | | -amgb_assert_uniform(x, msg="") = nothing |
85 | | - |
86 | 82 | amgb_diag(::SparseMatrixCSC{T,Int}, z::Vector{T},m=length(z),n=length(z)) where {T} = spdiagm(m,n,0=>z) |
87 | 83 | amgb_diag(::Matrix{T}, z::Vector{T},m=length(z),n=length(z)) where {T} = diagm(m,n,0=>z) |
88 | 84 |
|
@@ -1527,7 +1523,6 @@ function barrier(Q::Convex{T})::Barrier where T |
1527 | 1523 | y = map_rows_gpu(F0, args..., Dz) |
1528 | 1524 | # GPU-compatible: avoid inline closure by splitting computation |
1529 | 1525 | result = dot(w, y) + sum(w .* map_rows_gpu(dot, c, Dz)) |
1530 | | - amgb_assert_uniform(result, "f0: barrier function result") |
1531 | 1526 | result |
1532 | 1527 | end |
1533 | 1528 |
|
@@ -1690,7 +1685,6 @@ function amgb_step(Q::Vector{<:Convex{T}}, |
1690 | 1685 | line_search=ls, |
1691 | 1686 | printlog) |
1692 | 1687 | its[J] += SOL.k |
1693 | | - amgb_assert_uniform(SOL.converged, "eta: SOL.converged at j=$j J=$J") |
1694 | 1688 | if SOL.converged |
1695 | 1689 | z = z + R*SOL.x |
1696 | 1690 | end |
@@ -1964,19 +1958,15 @@ function newton(::Type{Mat}, ::Type{T}, |
1964 | 1958 | n = solve(symmetric(H), g) |
1965 | 1959 | @assert amgb_all_isfinite(n) |
1966 | 1960 | inc = dot(g,n) |
1967 | | - amgb_assert_uniform(inc, "newton: inc after dot(g,n)") |
1968 | 1961 | @debug("k=",k," y=",y," ‖g‖=",norm(g), " λ^2=",inc) |
1969 | 1962 | if inc<=0 |
1970 | 1963 | converged = true |
1971 | | - amgb_assert_uniform(converged, "newton: converged after inc<=0") |
1972 | 1964 | break |
1973 | 1965 | end |
1974 | 1966 | (xnext,ynext,gnext) = line_search(x,y,g,n,F0,F1;printlog) |
1975 | | - amgb_assert_uniform(ynext, "newton: ynext after line_search") |
1976 | 1967 | if stopping_criterion(ymin,ynext,gmin,gnext,n,sqrt(incmin),sqrt(inc)) #ynext>=ymin && norm(gnext)>=theta*norm(g) |
1977 | 1968 | @debug("converged: ymin=",ymin," ynext=",ynext," ‖gnext‖=",norm(gnext)," λ=",sqrt(inc)," λmin=",sqrt(incmin)) |
1978 | 1969 | converged = true |
1979 | | - amgb_assert_uniform(converged, "newton: converged after stopping_criterion") |
1980 | 1970 | end |
1981 | 1971 | x,y,g = xnext,ynext,gnext |
1982 | 1972 | gmin = min(gmin,norm(g)) |
|
0 commit comments