EMERGE_DEFAULT_OPTS

From Gentoo Wiki
Jump to: navigation, search
Other languages:

The EMERGE_DEFAULT_OPTS variable entries are appended to the emerge command line. It is often used to allow for concurrent emerge operations through the --jobs N and --load-average X.Y options, which tell Portage how many parallel package builds can be used 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 cores.

For example, to run up to three jobs in parallel:

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 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.