Throw an error in checktask when a task failed#54
Throw an error in checktask when a task failed#54oscardssmith merged 3 commits intoJuliaSIMD:mainfrom
checktask when a task failed#54Conversation
|
this is a package in not especially familiar with, so I wanted to see green CI, but CI seems somewhat broken |
|
Note that this is what @chriselrod suggested in JuliaSIMD/Polyester.jl#153. |
|
So, how do we proceed here? |
|
Bump |
|
Sorry for this taking so long. CI for this repo was broken (fixed by #55) |
|
Looks like CI is fixed! (although it still is requiring manual approval for some reason) |
|
@efaulhaber looks like this PR is broken. |
|
I spent the last half hour trying to understand this test, but I still don't know what it does: struct Copy{P} end
function (::Copy{P})(p::Ptr{UInt}) where {P}
_, (ptry, ptrx, N) = ThreadingUtilities.load(p, P, 2 * sizeof(UInt))
N > 0 || throw("This function throws if N == 0 for testing purposes.")
@simd ivdep for n ∈ 1:N
unsafe_store!(ptry, unsafe_load(ptrx, n), n)
end
ThreadingUtilities._atomic_store!(p, ThreadingUtilities.SPIN)
end
@generated function copy_ptr(::A, ::B) where {A,B}
c = Copy{Tuple{A,B,Int}}()
quote
@cfunction($c, Cvoid, (Ptr{UInt},))
end
end
function setup_copy!(p, y, x)
N = length(y)
@assert length(x) == N
py = pointer(y)
px = pointer(x)
fptr = copy_ptr(py, px)
offset = ThreadingUtilities.store!(p, fptr, sizeof(UInt))
ThreadingUtilities.store!(p, (py, px, N), offset)
end
@inline launch_thread_copy!(tid, y, x) = ThreadingUtilities.launch(setup_copy!, tid, y, x)
function test_copy(tid, N = 100_000)
a = rand(N)
b = rand(N)
c = rand(N)
x = similar(a) .= NaN
y = similar(b) .= NaN
z = similar(c) .= NaN
GC.@preserve a b c x y z begin
launch_thread_copy!(tid, x, a)
yield()
@assert !ThreadingUtilities.wait(tid)
launch_thread_copy!(tid, y, b)
yield()
@assert !ThreadingUtilities.wait(tid)
launch_thread_copy!(tid, z, c)
yield()
@assert !ThreadingUtilities.wait(ThreadingUtilities.taskpointer(tid))
end
@test a == x
@test b == y
@test c == z
endThe |
|
@chriselrod do you know what's should happen here? |
|
ThreadingUtilities.jl/test/threadingutilities.jl Lines 80 to 86 in e867205 This is supposed to
This PR changes whose responsibility it is to do what. Before, |
|
That makes sense. Thanks! I fixed the tests now and added a few comments. |
|
@oscardssmith Most tests are passing now. The nightly builds and docs failures seem to be unrelated. |
|
@oscardssmith would you mind also adding a new release? |
Solves JuliaSIMD/Polyester.jl#153.
Note that JuliaSIMD/Polyester.jl#154 should probably get merged first.