Skip to content

Commit

Permalink
Fixed remaining synhronization issues identified by the "event improv…
Browse files Browse the repository at this point in the history
…ements".
  • Loading branch information
krasznaa committed Mar 4, 2024
1 parent 9ae8ab5 commit d8083af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/include/vecmem/utils/impl/copy.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,16 @@ copy::event_type copy::setup(edm::view<SCHEMA> data) const {

// Copy the data layout to the device, if needed.
if (data.layout().ptr() != data.host_layout().ptr()) {
operator()(data.host_layout(), data.layout(), type::unknown);
assert(data.layout().capacity() > 0u);
[[maybe_unused]] bool did_copy =
copy_view_impl(data.host_layout(), data.layout(), type::unknown);
assert(did_copy);
}

// Initialize the "size variable(s)" correctly on the buffer.
if (data.size().ptr() != nullptr) {
memset(data.size(), 0);
assert(data.size().capacity() > 0u);
do_memset(data.size().capacity() * sizeof(char), data.size().ptr(), 0);
}
VECMEM_DEBUG_MSG(3,
"Prepared an SoA container of capacity %u "
Expand Down
3 changes: 2 additions & 1 deletion tests/cuda/test_cuda_containers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ TEST_F(cuda_containers_test, async_memory) {
vecmem::copy::type::host_to_device),
copy.to(vecmem::get_data(inputvec), device_resource),
outputvecdevice, stream);
copy(outputvecdevice, outputvechost, vecmem::copy::type::device_to_host);
copy(outputvecdevice, outputvechost, vecmem::copy::type::device_to_host)
->ignore();
stream.synchronize();

// Check the output.
Expand Down

0 comments on commit d8083af

Please sign in to comment.