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 allows for parallel emerge operations through the --jobs N and --load-average X.Y options. EMERGE_DEFAULT_OPTS is used by Portage to reference system load, or load average, and limit how many packages are built at a time.

Common use cases

Parallel builds

The --jobs N argument (short form: -jN) will emerge N jobs at a time. Providing no arguments to -j floods the processor with as many jobs as possible. This is not recommended. Values for N should be no more than 2GB of ram per processor core. Packages can reach this constraint.

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 tries to limit the load average of the system below the floating point number X.Y. The running jobs are again limited by the --jobs 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. Setting X.Y=N*0.9 to limit the load to 90% maintains 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.

MAKEOPTS and EMERGE_DEFAULT_OPTS are suited for long emerges including multiple source code files and make the most of the --jobs parameter. They should be used with caution and be commented out when they cause emerge errors.

See also