EMERGE_DEFAULT_OPTS

From Gentoo Wiki
Jump to:navigation Jump to:search

EMERGE_DEFAULT_OPTS is a variable for Portage that defines entries to be appended to the emerge command line.

EMERGE_DEFAULT_OPTS is often used to allow for concurrent emerge operations through the --jobs N and --load-average X.Y options, which tell Portage how many package builds can be ran simultaneously and up to what system load (load average) the parallelism can be used.

Common use cases

Parallel builds

With --jobs N (short form: -jN), emerge runs N jobs at a time (without an argument, -j will flood the processor with as many jobs as possible, and is not recommended). A typical value for N would be equal to the number of processor cores but not more processes than RAM/2GB.

For example, to run up to three build jobs simultaneously:

FILE /etc/portage/make.confEnabling 3 parallel package builds
EMERGE_DEFAULT_OPTS="--jobs 3"

When used with --load-average X.Y (short form: -lX.Y), emerge will try to keep the load average of the system less than X.Y, a floating point number. If --jobs is set as well, then it will run up to the limit indicated by that parameter.

The load average value is the same as displayed by top or uptime, and for an N-core system, a load average of N.0 would be a 100% load. Another rule of thumb here is to set X.Y=N*0.9 which will limit the load to 90%, thus maintaining system responsiveness.

Note
When MAKEOPTS="-jN" is used with EMERGE_DEFAULT_OPTS="--jobs K --load-average X.Y" the number of possible tasks created would be up to N*K. Therefore, both variables need to be set with each other in mind as they create up to K jobs each with up to N tasks.

These two settings are suited for long emerges which include multiple source code files to make the most of the --jobs parameter. They can also cause emerge errors in some cases, so use with caution and be prepared to comment these out if problems arise.

See also