Skip to content

Commit 71ee2fd

Browse files
committed
fix[hardware_predict]: Check if shared lib exists
1 parent c6e341f commit 71ee2fd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hls4ml/backends/vitis_accelerator/vitis_accelerator_backend.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ def hardware_predict(self, model, x, target="hw", debug=False, profilingRepeat=-
159159
# Change working directory to the HLS project directory
160160
os.chdir('model_va/hls4ml_prj')
161161

162+
# Check if the shared library exists
163+
if not os.path.exists('./lib_host.so'):
164+
print("Shared library 'lib_host.so': host code not compiled as a shared library.")
165+
print("Compiling host code as a shared library...")
166+
os.system('make host_shared')
167+
print("Shared library 'lib_host.so' compiled successfully.")
168+
162169
# Load the shared library
163170
lib = ctypes.cdll.LoadLibrary('./lib_host.so')
164171

0 commit comments

Comments
 (0)