SUMMARY
This article provides information on how you can limit the number of threads being used by Nuke using your init.py file. This is useful if you want to always limit Nuke to fewer threads than the total available on your machine.
MORE INFORMATION
By default, Nuke does not limit how many threads it will use, so will use what CPU threads it can. This can allow Nuke to use a lot of CPU resources, which can cause issues on some machines.
If you're encountering performance issues when using Nuke then sometimes it can be beneficial to lower the number of threads that Nuke runs with. You can do this either by launching Nuke with a command line flag or by setting a python customisation in your init.py file.
Command line flag:
You can limit the number of threads that Nuke uses by launching it from a terminal or command prompt with the -m flag. This is useful when troubleshooting problems but if you always want to limit the number of threads it may not be convenient to always launch Nuke from a terminal or command prompt.
Please see Q100117: Limiting threads in Nuke with the -m flag for instructions on how to use the command line flag.
Python customisation in your init.py file:
Alternatively, you can use Nuke's Python API to limit the number of thread Nuke launches with by adding a command to the init.py file in your ~/.nuke directory in your user directory.
Further information about adding code to your .nuke directory can be found the following article: Q100490: What are the init.py and menu.py startup script files
To set a thread limit for Nuke, open your init.py file with a text editor, creating it if is doesn't exist, and set a value for nuke.env['threads']. For example, to always launch with 8 threads you would add:
nuke.env['threads'] = 8 The next time you run Nuke it will launch with your specified number of threads.
Launching Nuke from a command prompt or terminal with the -m flag
will override the value set in your init.py file.
FURTHER READING
More information on start-up scripts can be found in the Configuring Nuke section of the Nuke User Guide and in the Python Developer's Guide for Nuke.
We're sorry to hear that
Please tell us why