High memory usage while building PyTorch from source

How can I reduce the RAM usage of compilation from source via python setup.py install command? It automatically spawns many threads and I don’t want that!

Try to set the MAX_JOBS argument to your desired max. number of jobs.

Is that a shell variable?
export MAX_JOBS=2

Yes. You could also set it in front of the install command: MAX_JOBS=2 python setup.py install.

1 Like