-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.jl
94 lines (76 loc) · 1.71 KB
/
setup.jl
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import REPL
using REPL.TerminalMenus
# Make sure JSON is installed
try
using JSON
catch ex
# Ask to install JSON
choice = request(
"Package JSON not installed - would you like me to install it?",
RadioMenu(["yes", "no"])
)
if choice == 1
using Pkg
Pkg.add("JSON")
using JSON
else
println("Canceling!")
exit()
end
end
# Constants for paths
AUTOTM_BUILD = joinpath(@__DIR__, "AutoTM", "deps", "build.json")
NGRAPH_BUILD = joinpath(@__DIR__, "deps", "nGraph", "deps", "build.json")
#####
##### Setup for nGraph
#####
options = ["yes", "no"]
# Select NVDIMMs
choice = request(
"Would you like to use NVDIMMs? (requires a Cascade Lake system with Optane)",
RadioMenu(options)
)
# Choice for using NVDIMMs
use_nvdimms = choice == 1
# Select GPU
choice = request(
"Would you like to build with GPU support?",
RadioMenu(options)
)
# Choice for using NVDIMMs
use_gpu = choice == 1
ngraph_json = JSON.parsefile(NGRAPH_BUILD)
if use_nvdimms
ngraph_json["PMDK"] = true
ngraph_json["NUMA"] = true
else
ngraph_json["PMDK"] = false
ngraph_json["NUMA"] = false
end
if use_gpu
ngraph_json["GPU"] = true
else
ngraph_json["GPU"] = false
end
open(NGRAPH_BUILD; write = true) do f
JSON.print(f, ngraph_json)
end
#####
##### Setup AutoTM
#####
# Select GPU
choice = request(
"Would you like to use Gurobi as the ILP solver?",
RadioMenu(options)
)
# Choice for using NVDIMMs
use_gurobi = choice == 1
autotm_json = JSON.parsefile(AUTOTM_BUILD)
if use_gurobi
autotm_json["GUROBI"] = true
else
autotm_json["GUROBI"] = false
end
open(AUTOTM_BUILD; write = true) do f
JSON.print(f, autotm_json)
end