Skip to content

Commit

Permalink
Don't use explicit per-stream threads. (#551)
Browse files Browse the repository at this point in the history
We generally already use the ptsd/ptsz API calls, so the default stream
equals the per-thread one.
  • Loading branch information
maleadt authored Nov 17, 2020
1 parent ff8ef96 commit 397bde0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/cudadrv/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,22 @@ Return the default stream.
CuStreamLegacy()
Return a special object to use use an implicit stream with legacy synchronization behavior.
You can use this stream to perform operations that should block on all streams (with the
exception of streams created with `CU_STREAM_NON_BLOCKING`). This matches the old pre-CUDA 7
global stream behavior.
"""
@inline CuStreamLegacy() = CuStream(convert(CUstream, 1), CuContext(C_NULL))

"""
CuStreamPerThread()
Return a special object to use an implicit stream with per-thread synchronization behavior.
This should generally only be used with compiled libraries, which cannot be switched to the
per-thread API calls. For all other uses, it be libraries compiled with `nvcc
--default-stream per-thread` or any CUDA API call using CUDA.jl (which defaults to the
per-thread variants) you can just use the default `CuDefaultStream` object.
"""
@inline CuStreamPerThread() = CuStream(convert(CUstream, 2), CuContext(C_NULL))

Expand Down
2 changes: 1 addition & 1 deletion src/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ end

function Base.unsafe_copyto!(dest::DenseCuArray{T}, doffs, src::DenseCuArray{T}, soffs, n) where T
GC.@preserve src dest unsafe_copyto!(pointer(dest, doffs), pointer(src, soffs), n;
async=true, stream=CuStreamPerThread())
async=true, stream=CuDefaultStream())
if Base.isbitsunion(T)
# copy selector bytes
error("Not implemented")
Expand Down

0 comments on commit 397bde0

Please sign in to comment.