@@ -44,7 +44,7 @@ def create_initial_config(
4444 config ['AcceleratorConfig' ]['Batchsize' ] = batchsize
4545 return config
4646
47- def build (self , model , target = "all" ):
47+ def build (self , model , reset = False , synth = True , vsynth = True ):
4848 if 'linux' in sys .platform :
4949 if 'XILINX_VITIS' not in os .environ :
5050 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"):
5353 if 'XILINX_VIVADO' not in os .environ :
5454 raise Exception ("XILINX_VIVADO environmental variable missing. Please install XRT and Vitis, and run the setup scripts before building" )
5555
56- if target not in ["all" , "host" , "hls" , "xclbin" ]:
57- raise Exception ("Invalid build target" )
58-
5956 curr_dir = os .getcwd ()
6057 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"
6175 command = "make " + target
76+
6277 # Pre-loading libudev
6378 ldconfig_output = subprocess .check_output (["ldconfig" , "-p" ]).decode ("utf-8" )
6479 for line in ldconfig_output .split ("\n " ):
6580 if "libudev.so" in line and "x86" in line :
6681 command = "LD_PRELOAD=" + line .split ("=>" )[1 ].strip () + " " + command
6782 break
6883 os .system (command )
84+
6985 os .chdir (curr_dir )
7086 else :
7187 raise Exception ("Currently untested on non-Linux OS" )
0 commit comments