-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e3b639
commit e657b19
Showing
21 changed files
with
176 additions
and
506 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
name = "ExaPF" | ||
uuid = "0cf0e50c-a82e-488f-ac7e-41ffdff1b8aa" | ||
authors = ["Adrian Maldonado <[email protected]>", "Michel Schanen <[email protected]>", "François Pacaud <[email protected]>"] | ||
version = "0.10.1" | ||
version = "0.11.0" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" | ||
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7" | ||
KrylovPreconditioners = "45d422c2-293f-44ce-8315-2cb988662dec" | ||
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" | ||
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
@@ -30,6 +31,7 @@ CUDA = "4.1, 5" | |
ForwardDiff = "0.10" | ||
KernelAbstractions = "0.9" | ||
Krylov = "0.9" | ||
KrylovPreconditioners = "0.2" | ||
LazyArtifacts = "1.9" | ||
LightGraphs = "1.3" | ||
LinearAlgebra = "1.9" | ||
|
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,70 @@ | ||
using CUDA | ||
using KernelAbstractions | ||
using ExaPF | ||
import ExaPF: AutoDiff | ||
using LazyArtifacts | ||
using LinearAlgebra | ||
using KrylovPreconditioners | ||
using PProf | ||
using Profile | ||
|
||
|
||
const PS = ExaPF.PowerSystem | ||
const LS = ExaPF.LinearSolvers | ||
# datafile = joinpath(artifact"ExaData", "ExaData", "matpower", "case_ACTIVSg70k.m") | ||
# datafile = joinpath(artifact"ExaData", "ExaData", "case1354.m") | ||
datafile = joinpath(artifact"ExaData", "ExaData", "case9241pegase.m") | ||
polar = ExaPF.PolarForm(datafile, CPU()) | ||
stack = ExaPF.NetworkStack(polar) | ||
ExaPF.init!(polar, stack) | ||
@time convergence = run_pf(polar, stack; verbose=1) | ||
|
||
pf = PS.PowerNetwork(datafile) | ||
polar_gpu = ExaPF.PolarForm(pf, CUDABackend()) | ||
stack_gpu = ExaPF.NetworkStack(polar_gpu) | ||
basis_gpu = ExaPF.PolarBasis(polar_gpu) | ||
pflow_gpu = ExaPF.PowerFlowBalance(polar_gpu) ∘ basis_gpu | ||
mapx = ExaPF.mapping(polar, State()); | ||
jx_gpu = ExaPF.Jacobian(polar_gpu, pflow_gpu, mapx) | ||
direct_linear_solver = LS.DirectSolver(jx_gpu.J) | ||
pf_algo = NewtonRaphson(; verbose=1, tol=1e-10) | ||
|
||
|
||
jac_gpu = jx_gpu.J; | ||
|
||
npartitions = div(size(jac_gpu,1), 32); | ||
precond = BlockJacobiPreconditioner(jac_gpu, npartitions, CUDABackend(), 0); | ||
# precond = KrylovPreconditioners.kp_ilu0(jac_gpu) | ||
# linear_solver = ExaPF.KrylovBICGSTAB(jac_gpu; P=precond, ldiv=false, scaling=true, atol=1e-10, verbose=0); | ||
# linear_solver = ExaPF.KrylovBICGSTAB(jac_gpu; P=precond, ldiv=false, scaling=false, atol=1e-10, verbose=0); | ||
# linear_solver = ExaPF.KrylovBICGSTAB(jac_gpu; P=precond, ldiv=false, scaling=false, atol=1e-10, verbose=0, maxiter=500); | ||
linear_solver = ExaPF.KrylovBICGSTAB( | ||
jac_gpu; P=precond, ldiv=false, scaling=true, | ||
rtol=1e-7, atol=1e-7, verbose=0 | ||
); | ||
pf_algo = NewtonRaphson(; verbose=1, tol=1e-7, maxiter=20) | ||
ExaPF.init!(polar_gpu, stack_gpu) | ||
reset_timer!(linear_solver.precond) | ||
@time convergence = ExaPF.nlsolve!(pf_algo, jx_gpu, stack_gpu; linear_solver=linear_solver) | ||
@show get_timer(linear_solver.precond) | ||
ExaPF.init!(polar_gpu, stack_gpu) | ||
@time convergence = ExaPF.nlsolve!(pf_algo, jx_gpu, stack_gpu; linear_solver=direct_linear_solver) | ||
@show linear_solver.inner.stats.niter | ||
@show convergence | ||
# Profiling | ||
ExaPF.init!(polar_gpu, stack_gpu) | ||
Profile.clear() | ||
Profile.@profile begin | ||
linear_solver.precond.timer_update = 0.0 | ||
convergence = ExaPF.nlsolve!(pf_algo, jx_gpu, stack_gpu; linear_solver=linear_solver) | ||
@show linear_solver.precond.timer_update | ||
end | ||
Profile.clear() | ||
ExaPF.init!(polar_gpu, stack_gpu) | ||
Profile.@profile begin | ||
linear_solver.precond.timer_update = 0.0 | ||
convergence = ExaPF.nlsolve!(pf_algo, jx_gpu, stack_gpu; linear_solver=linear_solver) | ||
@show linear_solver.precond.timer_update | ||
end | ||
PProf.pprof() | ||
@show convergence |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
```@meta | ||
CurrentModule = ExaPF | ||
DocTestSetup = quote | ||
using ExaPF | ||
const AD = ExaPF.AD | ||
|
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,4 +1,3 @@ | ||
|
||
```@meta | ||
CurrentModule = ExaPF | ||
DocTestSetup = quote | ||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.