Skip to content

Commit

Permalink
Fix DALI paddle plugin stream synchronization error (NVIDIA#3487)
Browse files Browse the repository at this point in the history
Signed-off-by: sneaxiy <[email protected]>
  • Loading branch information
sneaxiy authored Nov 16, 2021
1 parent 7b6e0df commit 9e141d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions dali/python/nvidia/dali/plugin/paddle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import math

import numpy as np
import paddle

from nvidia.dali import types
from nvidia.dali.backend import TensorListCPU, TensorGPU, TensorListGPU
Expand Down Expand Up @@ -72,6 +73,8 @@ def feed_ndarray(dali_tensor, ptr, cuda_stream=None):
(if not provided, an internal user stream will be selected)
"""

if cuda_stream is None:
cuda_stream = paddle.device.cuda.current_stream().cuda_stream
cuda_stream = types._raw_cuda_stream(cuda_stream)

c_type_pointer = ctypes.c_void_p(ptr)
Expand Down Expand Up @@ -315,12 +318,6 @@ def __next__(self):
category_pd_type[cat])
data_batches[i] = pd_tensors

# due to https://github.com/PaddlePaddle/Paddle/issues/35555 the tensors are allocated
# first by setting shape and calling _mutable_data, then the device is synchronized
# and after that, another call to _mutable_data is made to obtain the pointer and
# copy data from the pipeline to the tensor
# when the issue is solved the copy can be moved to the preceding loop
fluid.core._cuda_synchronize(pd_gpu_place)
for cat, tensor in category_tensors.items():
ptr = pd_tensors[cat]._mutable_data(category_place[cat],
category_pd_type[cat])
Expand Down
4 changes: 2 additions & 2 deletions qa/setup_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ def get_pyvers_name(self, url, cuda_version):
{ "101" : ["0.9.0"],
"111" : ["0.9.0"] }, extra_index="https://download.pytorch.org/whl/cu{cuda_v}/"),
CudaPackage("paddlepaddle-gpu",
{ "100" : ["2.0.2"],
"110" : ["2.0.2"]})
{ "100" : ["2.2.0"],
"110" : ["2.2.0"]})
]

all_packages_keys = [pckg.key for pckg in all_packages]
Expand Down

0 comments on commit 9e141d6

Please sign in to comment.