JuliaGPU / JuliaGPU/KernelAbstractions.jl

@print functionality inconsistent with CUDADevice()

Open
#112 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
523
Forks
88
Avg merge
1d 11h
Merged PRs (30d)
25

Description

This is more for my own reference later.

If I create the following kernel:

@kernel function check_kernel()

    cI = @index(Global)

    if cI == 2
        @print("cI is: ", cI, '\n')
    end
end

function check(use_gpu)
    if use_gpu
        kernel! = check_kernel(CUDADevice(), 256)
    else
        kernel! = check_kernel(CPU(),8)
    end
    kernel!(ndrange=256) 
end

I find odd behavior in the REPL:

julia> include("src/check.jl")
cI is: 2KernelAbstractions
.CudaEvent(CuEvent(Ptr{Nothing} @0x000055d1cee5f4c0, CuContext(Ptr{Nothing} @0x000055d1ce966110)))

julia> wait(check(true))

julia> wait(check(false))
cI is: 2

julia> exit()
cI is: 2

For some reason, the printing for kernels run on a CUDADevice() will only print on exiting the REPL

I guess there is some way to make the wait() function also prompt the @print macro, but it might take some digging.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior from the example in src/check.jl, comparing @print output for CUDADevice() and CPU() around wait(check(true)) and wait(check(false)). Read the @print and wait paths first; done means CUDA kernel output is available after the corresponding wait rather than only when the REPL exits.

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
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.