Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple cpu mem build export #641

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davidmmiller
Copy link
Contributor

This change will allow decoupling the cpu and memory settings during box build/install and the final exported box.

@ghost
Copy link

ghost commented Apr 28, 2013

I like the idea yet it gets tricky with Gentoo since base.sh populates /etc/portage/make.conf with entries based on $nr_cpus from settings.sh during the build time. As you export the box, you'd really want make.conf to change as well. /cc @pierreozoux

@pierreozoux
Copy link
Contributor

@vaskas I agree with you, we would have to handle that before the export.

Recreate make.conf with the right amount of cpu just before the export. Like in the reboot script : https://github.com/jedi4ever/veewee/blob/master/templates/gentoo-latest-i686-experimental/reboot.sh

@davidmmiller
Copy link
Contributor Author

There are two values that get set within make.conf with nr_cpus MAKEOPTS and EMERGE_DEFAULT_OPTS

Neither one is end of the world terrible at the current level on the smaller box exported.

MAKEOPTS="-j$((1 + $nr_cpus)) -l$nr_cpus.5"
from the make.conf man page:
MAKEOPTS
Use this variable if you want to use parallel make. For example, if you have a dual-processor sys-
tem, set this variable to "-j2" or "-j3" for enhanced build performance with many packages. Suggested
settings are between CPUs+1 and 2*CPUs+1. In order to avoid excess load, the --load-average option is
recommended. For more information, see make(1). Also see emerge(1) for information about analogous
--jobs and --load-average options.

from the make man page:
-l [load], --load-average[=load]
Specifies that no new jobs (commands) should be started if there are others jobs running and the load
average is at least load (a floating-point number). With no argument, removes a previous load limit.

EMERGE_DEFAULT_OPTS="-j$nr_cpus --quiet-build=y"
from the emerge man page:
-j [JOBS], --jobs[=JOBS]
Specifies the number of packages to build simultaneously. If this option is given without an argu-
ment, emerge will not limit the number of jobs that can run simultaneously. Also see the related
--load-average option. Similarly to the --quiet-build option, the --jobs option causes all build
output to be redirected to logs. Note that interactive packages currently force a setting of
--jobs=1. This issue can be temporarily avoided by specifying --accept-properties=-interactive.

There is a cleanup.sh script run right before the zerodisk.sh script and this is where I would put the change to the make.conf values. I'll push an update to this pull request that does this.

@ghost
Copy link

ghost commented Apr 30, 2013

Thanks @davidmmiller, sounds great! Also, If you are looking at the current template, I created a pull request that fixes it (#674).

@pierreozoux
Copy link
Contributor

👍 Thanks to you both :)

@mpapis
Copy link
Collaborator

mpapis commented Sep 30, 2014

hey, is this PR still valid? if it is could you rebase it on current master so it could be merged?

@davidmmiller
Copy link
Contributor Author

Valid? Yes.
Most likely valid beyond just Gentoo - as it could be useful to decouple the cpu_num and memory allocation of the end box from those available during creation/installation.

@mpapis
Copy link
Collaborator

mpapis commented Oct 8, 2014

ok then, can you please rebase on master, there were to many changes preventing simple merge and I would prefer not to loos anything in manual merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants