diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 367925f24..15631d112 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -32,6 +32,20 @@ to the sources if you want to edit there directly. Use with care and don't compile in that directory unless you know what you're doing +** Memory size and CPU-number + The number of CPUs in the virtual machine is determined by (the + first one that matches is used) + * If the variable =WM_VAGRANT_CPUS= exists then the number of CPUs + is set to this + * If the variable =WM_NCOMPPROCS= is set then the number of CPUs is + fixed with *half* that number (so that the virtual machine + doesn't make the machine unuable) + The amount of memory is set according to the number of CPUs: + $(1+N)*512$ Megabytes. This should allow half a Gigabyte for the OS + and half a Gigagbyte for each compiling process + + The hostname of the virtual machine is the hostname of the host + machine prepended with =vagrant.= * Virtual machines Currently existing virtual machines are - precise :: Latest LTS Ubuntu. Currently the default machine to use diff --git a/vagrantSandbox/Vagrantfile b/vagrantSandbox/Vagrantfile index d3b3eedd4..65c0eecb6 100644 --- a/vagrantSandbox/Vagrantfile +++ b/vagrantSandbox/Vagrantfile @@ -4,12 +4,29 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "..", "/FOAM-sources" + config.vm.hostname="vagrant."+ENV["HOSTNAME"] + + nrCPU=1 + if ENV["WM_VAGRANT_CPUS"] + nrCPU=ENV["WM_VAGRANT_CPUS"].to_i + else + if ENV["WM_NCOMPPROCS"] + nrCPU=ENV["WM_NCOMPPROCS"].to_i/2 + end + end + if nrCPU<1 + nrCPU=1 + end + config.vm.provider :virtualbox do |vb| # # Don't boot with headless mode # vb.gui = true # # # Use VBoxManage to customize the VM. For example to change memory: - vb.customize ["modifyvm", :id, "--memory", "1024"] + # vb.customize ["modifyvm", :id, "--memory", "1024"] + vb.cpus=nrCPU + # make sure each CPU has enough memory + vb.memory=512*(1+nrCPU) end # default