@@ -44,7 +44,7 @@ def create_initial_config(
44
44
config ['AcceleratorConfig' ]['Batchsize' ] = batchsize
45
45
return config
46
46
47
- def build (self , model , target = "all" ):
47
+ def build (self , model , reset = False , synth = True , vsynth = True ):
48
48
if 'linux' in sys .platform :
49
49
if 'XILINX_VITIS' not in os .environ :
50
50
raise Exception ("XILINX_VITIS environmental variable missing. Please install XRT and Vitis, and run the setup scripts before building" )
@@ -53,19 +53,35 @@ def build(self, model, target="all"):
53
53
if 'XILINX_VIVADO' not in os .environ :
54
54
raise Exception ("XILINX_VIVADO environmental variable missing. Please install XRT and Vitis, and run the setup scripts before building" )
55
55
56
- if target not in ["all" , "host" , "hls" , "xclbin" ]:
57
- raise Exception ("Invalid build target" )
58
-
59
56
curr_dir = os .getcwd ()
60
57
os .chdir (model .config .get_output_dir ())
58
+
59
+ if reset :
60
+ if vsynth :
61
+ os .system ("make cleanxclbin" )
62
+ if synth :
63
+ os .system ("make cleanhls" )
64
+ os .system ("rm -rf host" )
65
+
66
+ if vsynth :
67
+ if synth :
68
+ target = "all"
69
+ else :
70
+ target = "xclbin"
71
+ elif synth :
72
+ target = "hls"
73
+ else :
74
+ target = "host"
61
75
command = "make " + target
76
+
62
77
# Pre-loading libudev
63
78
ldconfig_output = subprocess .check_output (["ldconfig" , "-p" ]).decode ("utf-8" )
64
79
for line in ldconfig_output .split ("\n " ):
65
80
if "libudev.so" in line and "x86" in line :
66
81
command = "LD_PRELOAD=" + line .split ("=>" )[1 ].strip () + " " + command
67
82
break
68
83
os .system (command )
84
+
69
85
os .chdir (curr_dir )
70
86
else :
71
87
raise Exception ("Currently untested on non-Linux OS" )
0 commit comments