Skip to content

Commit

Permalink
[CI] Final integration of batch Hessian
Browse files Browse the repository at this point in the history
  • Loading branch information
frapac committed Jul 6, 2021
1 parent db1ca61 commit f136813
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion benchmark/evaluators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function run_reduced_evaluator(nlp, u; device=CPU())
print("Hessian \t")
H = similar(u, n, n)
@btime ExaPF.hessian!($nlp, $H, $u)
@btime ExaPF.batch_hessian!($nlp, $H, $u)
return
end

Expand Down
5 changes: 5 additions & 0 deletions deps/deps.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file pulls the dependencies using git branches for development

using Pkg
cusolverrf = PackageSpec(url="https://github.com/exanauts/BlockPowerFlow.jl.git", rev="master")
Pkg.add([cusolverrf])
13 changes: 11 additions & 2 deletions src/Evaluators/bridge_evaluator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ function ojtprod!(nlp::BridgeDeviceEvaluator, jv, u, σ, v)
end

function hessprod!(nlp::BridgeDeviceEvaluator, hv, u, v)
copyto!(nlp.bridge.v, v)
hessprod!(nlp.inner, nlp.bridge.jv, nlp.bridge.u, nlp.bridge.v)
copyto!(nlp.bridge.g, v)
hessprod!(nlp.inner, nlp.bridge.jv, nlp.bridge.u, nlp.bridge.g)
copyto!(hv, nlp.bridge.jv)
return
end
Expand All @@ -128,6 +128,15 @@ function hessian!(nlp::BridgeDeviceEvaluator, H, u)
return
end

function hessian_lagrangian_penalty_prod!(nlp::BridgeDeviceEvaluator, hv, u, y, σ, w, v)
copyto!(nlp.bridge.g, v)
copyto!(nlp.bridge.w, w)
copyto!(nlp.bridge.y, y)
hessian_lagrangian_penalty_prod!(nlp.inner, nlp.bridge.jv, nlp.bridge.u, nlp.bridge.y, σ, nlp.bridge.w, nlp.bridge.g)
copyto!(hv, nlp.bridge.jv)
return
end

function hessian_lagrangian_penalty!(nlp::BridgeDeviceEvaluator, H, u, y, σ, w)
copyto!(nlp.bridge.w, w)
copyto!(nlp.bridge.y, y)
Expand Down
1 change: 1 addition & 0 deletions test/cusolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ExaPF: LinearSolvers
import BlockPowerFlow: CUSOLVERRF

const LS = LinearSolvers
const CUDA_ARCH = (CUDADevice(), CuArray, CuSparseMatrixCSR)

# Overload factorization routine to use cusolverRF
LS.exa_factorize(J::CuSparseMatrixCSR) = CUSOLVERRF.CusolverRfLU(J)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const CASES = ["case9.m", "case30.m"]

ARCHS = Any[(CPU(), Array, SparseMatrixCSC)]
if has_cuda_gpu()
push!(ARCHS, (CUDADevice(), CuArray, CuSparseMatrixCSR))
include("cusolver.jl")
push!(ARCHS, CUDA_ARCH)
end

# Load test modules
Expand Down

0 comments on commit f136813

Please sign in to comment.