NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.77k stars 2.13k forks source link

How can I share TensorGPU object in multiple processes in python #1683

Closed AbhijitManepatil closed 2 years ago

AbhijitManepatil commented 2 years ago

I am using the NVIDIA Dali pipeline to get an output as a TensorGPU object, I like to share those TensorGPU objects (nvidia.dali.backend_impl.TensorGPU) among the other processes, I following the steps like

Please refer to the following code for reference:

from nvidia.dali.pipeline import Pipeline
import nvidia.dali.fn as fn
import pycuda.driver as drv

pipe = Pipeline(batch_size=batch_size, num_threads=1, device_id=0)
with pipe:
        for i in eii_list:
            images = fn.external_source(source=i, num_outputs=1,device="gpu",batch=False)           
            enhance = fn.brightness_contrast(images, contrast=1)            
            pipe.set_outputs(enhance)

pipe.build()
data=batch_gpu.at(0)
#this data is of type <class 'nvidia.dali.backend_impl.TensorGPU'>
h = drv.mem_get_ipc_handle(data.data_ptr()) #data_ptr is the pointer to the TensorGPU object

but while creating a handle for data_ptr it gives the error: cuIpcGetMemHandle failed: invalid argument

I would like to ask for help on two points:

ttyio commented 2 years ago

Hello @AbhijitManepatil , could you create a thread in https://forums.developer.nvidia.com/ since this is not TensorRT specific issue, thanks!

ttyio commented 2 years ago

Closing since no activity for more than 3 weeks, thanks!