NVENC Encoding inside of a virtual machine


Is it possible to use the NVENC API inside of a virtual machine using GRID?
If this is possible how many encodes can be preformed with K1/K2 cards?
Does it depend on the selected vGPU profile?



Yes it is possible and it’s not limited by the vGPU profile.

The number of streams is dependent on the resolution, frame rate etc. You can find card specifications here


Hello Jason_Southern

This question is actual again after GRID 2.0 release. We bought some Tesla m60 cards for Linux vGPU vms.

Is it possible to use NVENC on Linux virtual machine with vGPU?
Currently I have error related to "Failed to create CUDA context (101)". Does it mean that NVENC for Linux require CUDA support? Is it possible to use NVENC without CUDA? (for example using opengl buffers?)

Thank you.



You will either need to use an 8GB vGPU profile, the only one which supports CUDA at present. Or write the code to not use CUDA buffers.

The NVENC SDK is the best place for details on how to use it.


Hello Jason

This option is not acceptable for us. it is too expensive to use whole GPU just for Linux vm.

Yes, I know.
Let me explain my issue related to NVENC:

First, every NVENC API call require "void * encoder" object. This object can be created only by nvEncOpenEncodeSessionEx function.
But nvEncOpenEncodeSessionEx function require to provide me "pointer to CUDA device" or "pointer to Direct X device".
My develop/target platform is Linux. Microsoft is not implemented Direct X for Linux yet :).

So it is only one option to use NVENC for Linux - it is CUDA device. But CUDA is disabled for vGPU.

How can I use NVENC encoder using Linux vGPU vm? May be there any other way? Is it possible to use NVENC without CUDA?

Thank you.

NvEncOpenEncodeSessionEx documentation from NVENC header file.

// NvEncOpenEncodeSessionEx
 * \brief Opens an encoding session.
 * Opens an encoding session and returns a pointer to the encoder interface in
 * the \p **encoder parameter. The client should start encoding process by calling
 * this API first. 
 * The client must pass a pointer to IDirect3DDevice9/CUDA interface in the \p *device parameter.
 * If the creation of encoder session fails, the client must call ::NvEncDestroyEncoder API 
 * before exiting.
 * \param [in] openSessionExParams
 *    Pointer to a ::NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS structure.
 * \param [out] encoder
 *    Encode Session pointer to the NvEncodeAPI interface.

Try the DevTalk forum - https://devtalk.nvidia.com/

It is possible to use NVENC without CUDA as there are several ISV’s doing this today for applications that are being deployed via vGPU.

Hello Jason

Thank you for your advice. I posted my question on devtalk forum.

I tried to find any public service(streaming/remote app) with Linux vGPU support, but no services available now.
Do you know any service(ISV) which is already using Linux vGPU? Could you provide link please? (if it possible)

Grid K1 + passthough is best Linux solution for video encoding now. :(