Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

RuntimeError: CUDA error: invalid device ordinal #415

@JunkangLiu

Description

@JunkangLiu

Describe the bug
Calling the PytorchNvCodec raises following exception
RuntimeError: CUDA error: invalid device ordinal
Traceback (most recent call last): File "SamplePyTorch.py", line 201, in <module> main(gpu_id, encFilePath, decFilePath) File "SamplePyTorch.py", line 164, in main src_tensor = surface_to_tensor(rgb_pln) File "SamplePyTorch.py", line 87, in surface_to_tensor img_tensor = pnvc.DptrToTensor(surf_plane.GpuMem(), RuntimeError: CUDA error: invalid device ordinal
Traceback (most recent call last): File "SampleTorchResnet.py", line 1158, in <module> run_inference_on_video(gpu_id, input_video) File "SampleTorchResnet.py", line 1122, in run_inference_on_video img_tensor = pnvc.makefromDevicePtrUint8(surf_plane.GpuMem(), RuntimeError: CUDA error: invalid device ordinal

To Reproduce
This function raises the exception

surface_tensor = pnvc.makefromDevicePtrUint8(surfPlane.GpuMem(), surfPlane.Width(), surfPlane.Height(),
                                                         surfPlane.Pitch(), surfPlane.ElemSize())

Expected behavior
Work without exception.

I don't have libtorch installed
Whether to call PytorchNvCodec must install libtorch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions