Skip to content

Commit 5cd5dcd

Browse files
committed
KA environment
1 parent 033e4de commit 5cd5dcd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/utils/environment.jl

+23
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,29 @@ mutable struct AdmmEnv{T,TD,TI,TM} <: AbstractAdmmEnv{T,TD,TI,TM}
148148
end
149149
end
150150

151+
function ExaAdmm.AdmmEnv(opfdata, rho_va::Float64, rho_pq::Float64; use_gpu=false, ka_device=nothing, options...)
152+
if use_gpu
153+
if isa(ka_device, Nothing)
154+
T = Float64
155+
VT = CuVector{Float64}
156+
VI = CuVector{Int}
157+
MT = CuMatrix{Float64}
158+
else
159+
T = Float64
160+
VT = typeof(KAArray{Float64}(undef, 0))
161+
VI = typeof(KAArray{Int}(undef, 0))
162+
MT = typeof(KAArray{Float64}(undef, 0, 0))
163+
end
164+
else
165+
T = Float64
166+
VT = Vector{Float64}
167+
VI = Vector{Int}
168+
MT = Matrix{Float64}
169+
end
170+
env = ExaAdmm.AdmmEnv{T,VT,VI,MT}(opfdata, "proxal", rho_pq, rho_va; use_gpu=use_gpu, ka_device=ka_device, options...)
171+
return env
172+
end
173+
151174
function AdmmEnv{T,TD,TI,TM}(
152175
case::String, rho_pq::Float64, rho_va::Float64; case_format="matpower", verbose::Int=1, options...
153176
) where {T, TD<:AbstractArray{T}, TI<:AbstractArray{Int}, TM<:AbstractArray{T,2}}

0 commit comments

Comments
 (0)