Skip to content

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
  • Loading branch information
mzient committed Oct 23, 2024
1 parent 9052149 commit 383095e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dali/pipeline/operator/builtin/input_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ class InputOperator : public Operator<Backend>, virtual public BatchSizeProvider
order = tl_elm.front()->order();
}
tl_elm.front()->Copy(batch, order, use_copy_kernel);
CUDA_CALL(cudaEventRecord(*copy_to_storage_event.front(), order.stream()));
{
DeviceGuard dg(order.device_id());
CUDA_CALL(cudaEventRecord(*copy_to_storage_event.front(), order.stream()));
}
if (sync) {
CUDA_CALL(cudaEventSynchronize(*copy_to_storage_event.front()));
}
Expand Down
8 changes: 8 additions & 0 deletions dali/python/backend_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,14 @@ PYBIND11_MODULE(backend_impl, m) {
device_id = sample0.device_id();
}
AccessOrder order(stream, device_id);
if (order.is_device()) {
CUcontext ctx = nullptr;
CUDA_CALL(cuStreamGetCtx(order.stream(), &ctx));
CUDA_CALL(cuCtxPushCurrent(ctx));
CUdevice device;
CUDA_CALL(cuCtxGetDevice(&device));
CUDA_CALL(cuCtxPopCurrent(&ctx));
}
FeedPipeline<GPUBackend>(p, name, list, order, cuda_stream.is_none(), use_copy_kernel);
}
},
Expand Down

0 comments on commit 383095e

Please sign in to comment.