Skip to content

Commit c60e9d4

Browse files
committed
dead end?
1 parent 7ccea74 commit c60e9d4

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

ext/ExaModelsKernelAbstractions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ function ExaModels.sgradient!(
477477
f,
478478
x,
479479
adj,
480-
) where {B<:KernelAbstractions.Backend}
480+
) where {B<:KernelAbstractions.Backend}
481481
return kerg(backend)(y, f.f, f.itr, x, adj; ndrange = size(f.itr))
482482
end
483483

src/nlp.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,14 @@ function _constraint(c, f, pars, start, lcon, ucon)
490490
end
491491

492492
function constraint!(c::C, c1, gen::Base.Generator) where {C<:ExaCore}
493-
f = SIMDFunction(gen, offset0(c1, 0), c.nnzj, c.nnzh)
493+
f = SIMDFunction(gen, offset0(c1, 0), c.nnzj, c.nnzh; tsize = Base.size(c1.itr))
494494
pars = gen.iter
495495

496496
_constraint!(c, f, pars)
497497
end
498498

499499
function constraint!(c::C, c1, expr, pars) where {C<:ExaCore}
500-
f = _simdfunction(expr, offset0(c1, 0), c.nnzj, c.nnzh)
500+
f = _simdfunction(expr, offset0(c1, 0), c.nnzj, c.nnzh; tsize = Base.size(c1.itr))
501501

502502
_constraint!(c, f, pars)
503503
end
@@ -697,7 +697,7 @@ coord(itr, i, ::Tuple{}) = ()
697697
@inbounds @inline offset0(a::C, i) where {C<:ConstraintAug} = offset0(a.f, a.itr, i)
698698
@inbounds @inline offset0(f::F, itr, i) where {P<:Pair,F<:SIMDFunction{P}} =
699699
f.o0 + f.f.first(itr[i], nothing)
700-
@inbounds @inline offset0(f::F, itr, i) where {T<:Tuple,P<:Pair{T},F<:SIMDFunction{P}} = f.o0 + idxx(coord(itr, i, f.f.first), Base.size(itr))
700+
@inbounds @inline offset0(f::F, itr, i) where {T<:Tuple,P<:Pair{T},F<:SIMDFunction{P}} = f.o0 + idxx(coord(itr, i, f.f.first), f.tsize)
701701

702702
for (thing, val) in [(:solution, 1), (:multipliers_L, 0), (:multipliers_U, 2)]
703703
@eval begin

src/simdfunction.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Compressor{I}
1313
end
1414
@inline (i::Compressor{I})(n) where {I} = @inbounds i.inner[n]
1515

16-
struct SIMDFunction{F,C1,C2}
16+
struct SIMDFunction{F,C1,C2,T}
1717
f::F
1818
comp1::C1
1919
comp2::C2
@@ -22,6 +22,7 @@ struct SIMDFunction{F,C1,C2}
2222
o2::Int
2323
o1step::Int
2424
o2step::Int
25+
tsize::T
2526
end
2627

2728
"""
@@ -35,14 +36,14 @@ Returns a `SIMDFunction` using the `gen`.
3536
- `o1`: offset for the derivative evalution
3637
- `o2`: offset for the second-order derivative evalution
3738
"""
38-
function SIMDFunction(gen::Base.Generator, o0 = 0, o1 = 0, o2 = 0)
39+
function SIMDFunction(gen::Base.Generator, o0 = 0, o1 = 0, o2 = 0; tsize = ())
3940

4041
f = gen.f(Par(eltype(gen.iter)))
4142

42-
_simdfunction(f, o0, o1, o2)
43+
_simdfunction(f, o0, o1, o2; tsize = tsize)
4344
end
4445

45-
function _simdfunction(f, o0, o1, o2)
46+
function _simdfunction(f, o0, o1, o2; tsize = ())
4647
d = f(Identity(), AdjointNodeSource(nothing))
4748
y1 = []
4849
ExaModels.grpass(d, nothing, y1, nothing, 0, NaN)
@@ -59,5 +60,5 @@ function _simdfunction(f, o0, o1, o2)
5960
o2step = length(a2)
6061
c2 = Compressor(Tuple(findfirst(isequal(i), a2) for i in y2))
6162

62-
SIMDFunction(f, c1, c2, o0, o1, o2, o1step, o2step)
63+
SIMDFunction(f, c1, c2, o0, o1, o2, o1step, o2step, tsize)
6364
end

0 commit comments

Comments
 (0)