Skip to content

Commit 0c64365

Browse files
committed
Remove threads for now
1 parent 0859c73 commit 0c64365

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Nonlinear/SymbolicAD/SymbolicAD.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ function gradient_and_hessian(
812812
n = length(x)
813813
∇f = Vector{Any}(undef, n)
814814
H_by_x, ∇²f_by_x = [Tuple{Int,Int}[] for _ in 1:n], [Any[] for _ in 1:n]
815-
Threads.@threads for i in eachindex(x)
815+
for i in eachindex(x)
816816
xi = x[i]
817817
∇fi = simplify!(derivative(f, xi))
818818
∇f[i] = ∇fi
@@ -1437,7 +1437,7 @@ function _evaluate!(model::Evaluator, x)
14371437
if o !== nothing
14381438
_evaluate!(model.dag[o.hash], o, x)
14391439
end
1440-
Threads.@threads for h in collect(keys(model.constraint_index_by_hash))
1440+
for h in collect(keys(model.constraint_index_by_hash))
14411441
dag = model.dag[h]
14421442
for i in model.constraint_index_by_hash[h]
14431443
_evaluate!(dag, model.constraints[i], x)
@@ -1461,7 +1461,7 @@ end
14611461
function MOI.eval_objective_gradient(model::Evaluator, ∇f, x)
14621462
_evaluate!(model, x)
14631463
fill!(∇f, 0.0)
1464-
Threads.@threads for i in eachindex(model.objective.x)
1464+
for i in eachindex(model.objective.x)
14651465
xi = model.objective.x[i]
14661466
∇f[xi] = model.objective.result[1+i]
14671467
end
@@ -1470,7 +1470,7 @@ end
14701470

14711471
function MOI.eval_constraint(model::Evaluator, g, x)
14721472
_evaluate!(model, x)
1473-
Threads.@threads for i in eachindex(model.constraints)
1473+
for i in eachindex(model.constraints)
14741474
g[i] = model.constraints[i].result[1]
14751475
end
14761476
return
@@ -1479,7 +1479,7 @@ end
14791479
function MOI.jacobian_structure(model::Evaluator)
14801480
d = last(model.constraints)
14811481
J = Vector{Tuple{Int,Int}}(undef, d.jac_offset + length(d.x))
1482-
Threads.@threads for i in eachindex(model.constraints)
1482+
for i in eachindex(model.constraints)
14831483
c = model.constraints[i]
14841484
for (j, xj) in enumerate(c.x)
14851485
J[c.jac_offset+j] = (i, xj)
@@ -1490,7 +1490,7 @@ end
14901490

14911491
function MOI.eval_constraint_jacobian(model::Evaluator, J, x)
14921492
_evaluate!(model, x)
1493-
Threads.@threads for c in model.constraints
1493+
for c in model.constraints
14941494
for j in eachindex(c.x)
14951495
J[c.jac_offset+j] = c.result[1+j]
14961496
end
@@ -1514,7 +1514,7 @@ function MOI.hessian_lagrangian_structure(model::Evaluator)
15141514
H[k] = (o.x[hi], o.x[hj])
15151515
end
15161516
end
1517-
Threads.@threads for c in model.constraints
1517+
for c in model.constraints
15181518
for (k, (hi, hj)) in enumerate(model.H[c.hash])
15191519
H[c.hess_offset+k] = (c.x[hi], c.x[hj])
15201520
end
@@ -1531,7 +1531,7 @@ function MOI.eval_hessian_lagrangian(model::Evaluator, H, x, σ, μ)
15311531
H[offset+j] = σ * o.result[j]
15321532
end
15331533
end
1534-
Threads.@threads for i in eachindex(model.constraints)
1534+
for i in eachindex(model.constraints)
15351535
c = model.constraints[i]
15361536
# It is important that `offset_c` does not shadow `offset` from the
15371537
# objective block. If we use the same name, Julia creates a Core.Box

0 commit comments

Comments
 (0)