Skip to content

Commit c096079

Browse files
committed
fixup! datadeps: Fix GPU execution
1 parent b5c29da commit c096079

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/datadeps/remainders.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ function read_remainder!(copies::Vector{UInt8}, copies_offset::UInt64, from::Den
482482
elsize = sizeof(eltype(from))
483483
from_offset = UInt64((from_ptr - UInt64(pointer(from))) / elsize) + UInt64(1)
484484
from_vec = reshape(from, prod(size(from)))::DenseVector{eltype(from)}
485-
copyto!(copies, Int(copies_offset), from_vec, Int(from_offset), Int(n))
485+
copies_typed = unsafe_wrap(Vector{eltype(from)}, Ptr{eltype(from)}(pointer(copies, copies_offset)), n)
486+
copyto!(copies_typed, 1, from_vec, Int(from_offset), Int(n))
486487
end
487488
function read_remainder!(copies::Vector{UInt8}, copies_offset::UInt64, from::SubArray, from_ptr::UInt64, n::UInt64)
488489
read_remainder!(copies, copies_offset, parent(from), from_ptr, n)
@@ -492,7 +493,8 @@ function write_remainder!(copies::Vector{UInt8}, copies_offset::UInt64, to::Dens
492493
elsize = sizeof(eltype(to))
493494
to_offset = UInt64((to_ptr - UInt64(pointer(to))) / elsize) + UInt64(1)
494495
to_vec = reshape(to, prod(size(to)))::DenseVector{eltype(to)}
495-
copyto!(to_vec, Int(to_offset), copies, Int(copies_offset), Int(n))
496+
copies_typed = unsafe_wrap(Vector{eltype(to)}, Ptr{eltype(to)}(pointer(copies, copies_offset)), n)
497+
copyto!(to_vec, Int(to_offset), copies_typed, 1, Int(n))
496498
end
497499
function write_remainder!(copies::Vector{UInt8}, copies_offset::UInt64, to::SubArray, to_ptr::UInt64, n::UInt64)
498500
write_remainder!(copies, copies_offset, parent(to), to_ptr, n)

0 commit comments

Comments
 (0)