Skip to content

Commit 9da3f3c

Browse files
committed
WIP
1 parent 9e51291 commit 9da3f3c

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

examples/scopf.jl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,14 @@ elseif mode == :twostage
128128
model, vars, cons, info = scopf_twostage_model(case, contingencies; form = form, backend = backend)
129129
@info "Model size" n_var = model.meta.nvar n_con = model.meta.ncon schur = info
130130

131-
# Schur KKT: the per-scenario sparse blocks are factorized by cuDSS on GPU
132-
# (batched) / MUMPS on CPU internally; `linear_solver` here is for the
133-
# first-stage Schur complement — LAPACK (dense) on CPU, cuDSS (sparse) on GPU.
134-
# The GPU Schur complement is assembled as a sparse matrix (only the coupled
135-
# base-dispatch design vars fill it) and factorized by cuDSS. The scenario
136-
# dimensions and per-variable/per-constraint scenario tags come from the
137-
# model's two-stage tags; the tags let the Schur solver partition the
138-
# interleaved layout and fold the `nc_design` base-case design constraints
139-
# into its first-stage block.
140-
lin = backend === nothing ? MadNLP.LapackCPUSolver : MadNLPGPU.CUDSSSolver
131+
# Schur KKT: both the per-scenario blocks AND the first-stage Schur complement
132+
# are sparse — the complement fills only the coupled base-dispatch design vars.
133+
# `linear_solver` here factorizes that sparse complement: MUMPS on CPU, cuDSS on
134+
# GPU (both symmetric-indefinite, report inertia). The scenario dimensions and
135+
# per-variable/per-constraint scenario tags come from the model's two-stage tags;
136+
# the tags let the Schur solver partition the interleaved layout and fold the
137+
# `nc_design` base-case design constraints into its first-stage block.
138+
lin = backend === nothing ? MadNLP.MumpsSolver : MadNLPGPU.CUDSSSolver
141139
kkt_opts = schur_kkt_options(info, backend, cudss_ir)
142140
result = madnlp(model;
143141
callback = MadNLP.SparseCallback,
@@ -165,9 +163,9 @@ elseif mode == :compare
165163
pg_single = Array(solution(r1, v1.pg))[:, 1]
166164

167165
m2, v2, _, info = scopf_twostage_model(case, contingencies; form = form, backend = backend)
168-
# First-stage Schur complement solver: LAPACK (dense) on CPU, cuDSS (sparse) on
169-
# GPU. The per-scenario sparse blocks use cuDSS/MUMPS internally.
170-
lin = backend === nothing ? MadNLP.LapackCPUSolver : MadNLPGPU.CUDSSSolver
166+
# Sparse first-stage Schur complement solver: MUMPS on CPU, cuDSS on GPU. The
167+
# per-scenario sparse blocks use cuDSS/MUMPS internally.
168+
lin = backend === nothing ? MadNLP.MumpsSolver : MadNLPGPU.CUDSSSolver
171169
r2 = madnlp(m2;
172170
callback = MadNLP.SparseCallback,
173171
kkt_system = MadNLP.SchurComplementKKTSystem,

0 commit comments

Comments
 (0)