Skip to content

Commit 666ce55

Browse files
committed
Fix initialization of CUDA context on the default device during pipeline creation (#829)
- when DALI pipeline is created there was CUDA call without preceding setDevice what caused the creation of a context on the default device (GPU0). Add DeviceGuard. Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
1 parent 8a8bfcd commit 666ce55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dali/pipeline/pipeline.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ class DLL_PUBLIC Pipeline {
325325
bool separated_execution, bool async_execution, size_t bytes_per_sample_hint,
326326
bool set_affinity, int max_num_stream, int default_cuda_stream_priority,
327327
QueueSizes prefetch_queue_depth = QueueSizes{2}) {
328+
// guard cudaDeviceGetStreamPriorityRange call
329+
DeviceGuard g(device_id);
328330
this->batch_size_ = batch_size;
329331
this->num_threads_ = num_threads;
330332
this->device_id_ = device_id;

0 commit comments

Comments
 (0)