-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
57 lines (51 loc) · 1.18 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- mode: ruby -*-
# vi: set ft=ruby :
LIBVIRT_POOL = 'fast'
GPUS = ENV.map{ |key, value|
if key.start_with?("GPU")
h = {}
value.split(ENV['DELIM']).each_with_index{ |s, i|
case i
when 0
# h[:domain] = s
when 1
h[:bus] = s
when 2
h[:slot] = s
when 3
h[:function] = s
end
}
h
else
nil
end
}.compact
if GPUS.length > 0
puts "These are the passed GPUs"
puts GPUS
else
puts "No GPUs passed"
end
Vagrant.configure("2") do |config|
config.vm.define "datalab" do |config|
config.tun.enabled = true
config.vm.hostname = "datalab"
config.vm.box = "generic/ubuntu1604"
config.vm.synced_folder ".", "/home/vagrant", type: "nfs", nfs_udp: false
config.vm.network "private_network", ip: "192.168.18.9"
config.vm.provider "libvirt" do |v|
v.driver = "kvm"
v.host = 'localhost'
v.uri = 'qemu:///system'
v.memory = 6096
v.cpus = 4
v.machine_type = "q35"
v.cpu_mode = "host-passthrough"
v.kvm_hidden = true
GPUS.each { |gpu|
v.pci :bus => gpu[:bus], :slot => gpu[:slot], :function => gpu[:function]
}
end
end
end