JuliaGPU / JuliaGPU/KernelAbstractions.jl
`wait` some times fails
Open
Nobody has claimed this yet.
bug
- Dominant language
- Julia
- Stars
- 523
- Forks
- 88
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 25
Description
When you call wait on both CPU and GPU. The synchronization can be unstable. The error message is
any: Test Failed at /home/leo/jcode/lab/wait_fail.jl:34
Expression: Array(c1) ≈ ones(100)
Evaluated: Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ≈ [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 … 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
Stacktrace:
[1] top-level scope at /home/leo/jcode/lab/wait_fail.jl:34
[2] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Test/src/Test.jl:1113
[3] top-level scope at /home/leo/jcode/lab/wait_fail.jl:31
Test Summary: | Pass Fail Total
any | 1 1 2
MWE: you need to try the test for about 10 times, or more
using CuArrays, KernelAbstractions
using Test
@kernel function ba_kernel(x)
i = @index(Global)
x[i] += 1
end
function f1()
nthread=4
a = zeros(100)
event1 = ba_kernel(CPU(), nthread)(a; ndrange=100)
wait(event1)
a
end
function f2()
blockdim=256
x = CuArrays.zeros(100)
event1 = ba_kernel(CUDA(), blockdim)(x; ndrange=100)
wait(event1)
x
end
@testset "fail sometime" begin
r1 = f1()
c1 = f2()
@test r1 ≈ ones(100)
@test Array(c1) ≈ ones(100)
end
@testset "always work" begin
c1 = f2()
@test Array(c1) ≈ ones(100)
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Julia MWE repeatedly, focusing on the CPU and GPU calls to ba_kernel and their wait(event1) usage. Compare the intermittent results from the “fail sometime” testset with the consistently passing GPU-only testset. Done means synchronization is stable and both result arrays match ones(100) across repeated runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100