Skip to content

Commit c62e60b

Browse files
Merge pull request #10 from lazarusA/up_project_toml
up compat Polyester
2 parents 2c6d8e7 + b3f8a47 commit c62e60b

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.jl.mem
44
/Manifest.toml
55
/docs/build/
6+
.vscode
67
*~
78
*#*
89
*#*#

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588"
99

1010
[compat]
1111
ForwardDiff = "0.10"
12-
Polyester = "0.5, 0.6"
12+
Polyester = "0.5, 0.6, 0.7"
1313
julia = "1.6"
1414

1515
[extras]

src/PolyesterForwardDiff.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function threaded_gradient!(f::F, Δx::AbstractVector, x::AbstractVector, ::Forw
4848
N = length(x)
4949
d = cld_fast(N, C)
5050
r = Ref{eltype(Δx)}()
51-
batch((d,min(d,num_threads())), r, Δx, x) do rΔxx,start,stop
51+
batch((d,min(d,Threads.nthreads())), r, Δx, x) do rΔxx,start,stop
5252
evaluate_chunks!(f, rΔxx, start, stop, ForwardDiff.Chunk{C}())
5353
end
5454
r[]
@@ -105,7 +105,7 @@ end
105105
function threaded_jacobian!(f::F, Δx::AbstractArray, x::AbstractArray, ::ForwardDiff.Chunk{C}) where {F,C}
106106
N = length(x)
107107
d = cld_fast(N, C)
108-
batch((d,min(d,num_threads())), Δx, x) do Δxx,start,stop
108+
batch((d,min(d,Threads.nthreads())), Δx, x) do Δxx,start,stop
109109
evaluate_jacobian_chunks!(f, Δxx, start, stop, ForwardDiff.Chunk{C}())
110110
end
111111
return Δx
@@ -162,7 +162,7 @@ end
162162
function threaded_jacobian!(f!::F, y::AbstractArray, Δx::AbstractArray, x::AbstractArray, ::ForwardDiff.Chunk{C}) where {F,C}
163163
N = length(x)
164164
d = cld_fast(N, C)
165-
batch((d,min(d,num_threads())), y, Δx, x) do yΔxx,start,stop
165+
batch((d,min(d,Threads.nthreads())), y, Δx, x) do yΔxx,start,stop
166166
evaluate_f_and_jacobian_chunks!(f!, yΔxx, start, stop, ForwardDiff.Chunk{C}())
167167
end
168168
Δx

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ForwardDiff.gradient!(dxref, f, x, ForwardDiff.GradientConfig(f, x, ForwardDiff.
1111
@test dx == dxref
1212

1313
dx .= NaN;
14-
batch((length(x), max(1,num_threads()>>1), 2), dx, x) do (dx,x), start, stop
14+
batch((length(x), max(1,Threads.nthreads()>>1), 2), dx, x) do (dx,x), start, stop
1515
PolyesterForwardDiff.threaded_gradient!(f, view(dx, start%Int:stop%Int), view(x, start%Int:stop%Int), ForwardDiff.Chunk(8))
1616
end;
1717
@test dx dxref

0 commit comments

Comments
 (0)