Q100739: Katana not using all available CPU cores during rendering on Linux with certain NVIDIA drivers

SYMPTOMS

When using some NVIDIA drivers on Linux, Katana does not use all available CPU cores during rendering, leaving the rest idle, resulting in slower render times than the hardware should deliver. The issue has been confirmed with the following driver versions:

  • NVIDIA 580.95.05
  • NVIDIA 590.48.01

 

CAUSE

The problem comes from an OpenGL initialisation step that Katana runs at startup. With the affected drivers, this step reduces Katana's CPU affinity to a subset of the cores, and any render process Katana launches then inherits that reduced affinity.

To see the current state of the CPU affinity, run the following in Katana's Python tab:

  1. Open the Python tab in Katana.
  2. Paste the following code:
import _PyFnGeoBase
print(_PyFnGeoBase.ProcessInfo.GetCPUAffinity())
  1. Execute it.

You should see the list of cores Katana is allowed to use. On an unaffected machine, every core is listed, for example:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]

If the issue is present, the list is shorter — only a subset of the machine's cores appears.


 

RESOLUTION

You can resolve this problem by either:

  • Upgrading to Katana 8.5v2 or 9.0v2 
  • Updating your Nvidia driver version to 595, or later. 

However, if upgrading is not possible, then you can use one of the following workarounds instead:

  1. Set the __GL_THREADED_OPTIMIZATIONS=1 environment variable in the shell or launch script that starts Katana, before launching it (for example, run  export __GL_THREADED_OPTIMIZATIONS=1 in the terminal, then start Katana from that same terminal).
     
  2. Reset the process affinity to all cores by running the following in a Python tab in Katana:
import subprocess, os
subprocess.check_call(('taskset', '-a', '-p', 'ffffffffffffffff', str(os.getpid())))


 

FURTHER READING

For further information about the __GL_THREADED_OPTIMIZATIONS variable used in the workaround, you can visit the following page:

NVIDIA – Specifying OpenGL Environment Variable Settings

If you have tried the steps above, and you find that Katana is still not using all available CPU cores during rendering, then please open a Support ticket and let us know the exact issue you are encountering, your Katana and NVIDIA driver versions, and the troubleshooting steps you have taken so far. For more information on how to open a Support ticket, please refer to our Q100064: How to raise a support ticket article. 

    We're sorry to hear that

    Please tell us why