-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'weiqi/ucmp' of github.com:exanauts/ExaAdmm.jl into weiq…
…i/ucmp
- Loading branch information
Showing
53 changed files
with
3,113 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Manifest.toml | ||
docs/build | ||
docs/Manifest.toml | ||
.vscode/settings.json | ||
Manifest.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ExaData] | ||
git-tree-sha1 = "df547b1e5d707fdb88721eee9bf84f9211e1fb50" | ||
lazy = true | ||
[[ExaData.download]] | ||
url = "https://web.cels.anl.gov/~mschanen/ExaData-e1b6123.tar.gz" | ||
sha256 = "f6e22f26fbf273e97625a25b1b55f07d0eb0e15283483c545dda6eda84c48fdd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "ExaAdmm" | ||
uuid = "4d6a948c-1075-4240-a564-361a5d4e22a2" | ||
authors = ["Youngdae Kim <[email protected]>", "Kibaek Kim <[email protected]>", "Weiqi Zhang <[email protected]>", "François Pacaud <[email protected]>", "Michel Schanen <[email protected]>"] | ||
version = "0.3.2" | ||
authors = ["Youngdae Kim <[email protected]>", "Kibaek Kim <[email protected]>", "Weiqi Zhang <[email protected]>", "Bowen Li <[email protected]>", "François Pacaud <[email protected]>", "Michel Schanen <[email protected]>"] | ||
version = "0.4.2" | ||
|
||
[deps] | ||
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" | ||
|
@@ -19,9 +19,9 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | |
|
||
[compat] | ||
AMDGPU = "0.4" | ||
CUDA = "3.4" | ||
ExaTron = "2" | ||
CUDA = "4.1" | ||
ExaTron = "3" | ||
FileIO = "1.14" | ||
KernelAbstractions = "0.8" | ||
MPI = "0.19" | ||
KernelAbstractions = "0.9" | ||
MPI = "0.20" | ||
julia = "1.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
function admm_one_level( | ||
env::AdmmEnv, mod::AbstractOPFModel | ||
) | ||
par = env.params | ||
info = mod.info | ||
sol = mod.solution | ||
|
||
sqrt_d = sqrt(mod.nvar) | ||
OUTER_TOL = sqrt_d*(par.outer_eps) #adjusted outer loop tolerance | ||
|
||
fill!(info, 0) | ||
info.mismatch = Inf | ||
|
||
#eliminate second level | ||
info.norm_z_prev = info.norm_z_curr = 0 | ||
par.initial_beta = 0 | ||
par.beta = 0 | ||
sol.lz .= 0 | ||
sol.z_curr .= 0 | ||
sol.z_prev .= 0 | ||
par.inner_iterlim = 1 | ||
|
||
if par.verbose > 0 | ||
admm_update_residual(env, mod) | ||
@printf("%8s %10s %10s %10s %10s %10s %10s\n", | ||
"Iter", "Objval", "Auglag", "PrimRes", "PrimTol", "DualRes", "DualTol") | ||
|
||
@printf("%8d %10.3e %10.3e %10.3e %10.3e %10.3e %10.3e\n", | ||
info.outer, info.objval, info.auglag, info.mismatch, OUTER_TOL, info.dualres, OUTER_TOL*norm(sol.rho)/sqrt_d) | ||
end | ||
|
||
info.status = :IterationLimit | ||
|
||
overall_time = @timed begin | ||
while info.outer < par.outer_iterlim | ||
admm_increment_outer(env, mod) | ||
|
||
|
||
admm_increment_reset_inner(env, mod) | ||
while info.inner < par.inner_iterlim | ||
admm_increment_inner(env, mod) | ||
|
||
admm_update_x(env, mod) | ||
|
||
admm_update_xbar(env, mod) | ||
|
||
admm_update_l_single(env, mod) | ||
|
||
admm_update_residual(env, mod) | ||
|
||
if par.verbose > 0 | ||
if (info.cumul % 50) == 0 | ||
@printf("%8s %10s %10s %10s %10s %10s %10s\n", | ||
"Iter", "Objval", "Auglag", "PrimRes", "PrimTol", "DualRes", "DualTol") | ||
end | ||
|
||
@printf("%8d %10.3e %10.3e %10.3e %10.3e %10.3e %10.3e\n", | ||
info.outer, info.objval, info.auglag, info.mismatch, OUTER_TOL, info.dualres, OUTER_TOL*norm(sol.rho)/sqrt_d) | ||
end | ||
|
||
end # while inner | ||
|
||
# mismatch: x-xbar | ||
if info.mismatch <= OUTER_TOL && info.dualres <= OUTER_TOL*norm(sol.rho)/sqrt_d | ||
info.status = :Solved | ||
break | ||
end | ||
|
||
end # while outer | ||
end # @timed | ||
|
||
info.time_overall = overall_time.time | ||
admm_poststep(env, mod) | ||
|
||
if par.verbose > 0 | ||
print_statistics(env, mod) | ||
end | ||
|
||
return | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
function solve_qpsub( | ||
case::String, | ||
Hs, | ||
LH_1h, | ||
RH_1h, | ||
LH_1i, | ||
RH_1i, | ||
LH_1j, | ||
RH_1j, | ||
LH_1k, | ||
RH_1k, | ||
ls, | ||
us, | ||
pgmax, | ||
pgmin, | ||
qgmax, | ||
qgmin, | ||
c1, | ||
c2, | ||
Pd, | ||
Qd, | ||
initial_beta; | ||
case_format = "matpower", | ||
outer_iterlim = 20, | ||
inner_iterlim = 1000, | ||
rho_pq = 400.0, | ||
rho_va = 40000.0, | ||
obj_scale = 1.0, | ||
scale = 1e-4, | ||
storage_ratio = 0.0, | ||
storage_charge_max = 1.0, | ||
use_gpu = false, | ||
use_linelimit = true, | ||
use_projection = false, | ||
tight_factor = 1.0, | ||
outer_eps = 2 * 1e-4, | ||
gpu_no = 0, | ||
verbose = 1, | ||
onelevel = true, | ||
) | ||
T = Float64 | ||
TD = Array{Float64,1} | ||
TI = Array{Int,1} | ||
TM = Array{Float64,2} | ||
if use_gpu | ||
CUDA.device!(gpu_no) | ||
TD = CuArray{Float64,1} | ||
TI = CuArray{Int,1} | ||
TM = CuArray{Float64,2} | ||
end | ||
|
||
env = AdmmEnv{T,TD,TI,TM}( | ||
case, | ||
rho_pq, | ||
rho_va; | ||
case_format = case_format, | ||
use_gpu = use_gpu, | ||
use_linelimit = use_linelimit, | ||
use_projection = use_projection, | ||
tight_factor = tight_factor, | ||
gpu_no = gpu_no, | ||
storage_ratio = storage_ratio, | ||
storage_charge_max = storage_charge_max, | ||
verbose = verbose, | ||
) | ||
mod = ModelQpsub{T,TD,TI,TM}(env) | ||
|
||
data = mod.grid_data | ||
|
||
mod.Hs = copy(Hs) | ||
mod.LH_1h = copy(LH_1h) | ||
mod.RH_1h = copy(RH_1h) | ||
mod.LH_1i = copy(LH_1i) | ||
mod.RH_1i = copy(RH_1i) | ||
mod.LH_1j = copy(LH_1j) | ||
mod.RH_1j = copy(RH_1j) | ||
mod.LH_1k = copy(LH_1k) | ||
mod.RH_1k = copy(RH_1k) | ||
mod.ls = copy(ls) | ||
mod.us = copy(us) | ||
|
||
mod.qpsub_pgmax = copy(pgmax) | ||
mod.qpsub_pgmin = copy(pgmin) | ||
mod.qpsub_qgmax = copy(qgmax) | ||
mod.qpsub_qgmin = copy(qgmin) | ||
|
||
mod.qpsub_c1 = copy(c1) | ||
mod.qpsub_c2 = copy(c2) | ||
mod.qpsub_Pd = copy(Pd) | ||
mod.qpsub_Qd = copy(Qd) | ||
|
||
env.params.scale = scale | ||
env.params.obj_scale = obj_scale | ||
env.params.outer_eps = outer_eps | ||
env.params.outer_iterlim = outer_iterlim | ||
env.params.inner_iterlim = inner_iterlim | ||
env.params.shmem_size = sizeof(Float64) * (16 * mod.n + 4 * mod.n^2 + 178) + sizeof(Int) * (4 * mod.n) | ||
env.params.initial_beta = initial_beta #use my initial beta | ||
|
||
init_solution!(mod, mod.solution, env.initial_rho_pq, env.initial_rho_va) | ||
|
||
#one-level or two-level admm | ||
if onelevel | ||
admm_one_level(env, mod) | ||
else | ||
@warn "two-level ADMM is not implemented in QPsub" | ||
end | ||
return env, mod | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.