Skip to content
Snippets Groups Projects
Commit 7d535a74 authored by auphelia's avatar auphelia
Browse files

[Test] Finished subprocess call for compilation and execution of the generated c++ code

parent a1c3832a
No related branches found
No related tags found
No related merge requests found
......@@ -24,19 +24,20 @@ class StreamingMaxPool(HLSCustomOp):
temp_files.append("input_{}.npy".format(in_ind))
in_ind += 1
self.code_generation(node)
temp_files.append("execute_StreamingMaxPool.cpp")
bash_compile = """g++ -o execute_StreamingMaxPool execute_StreamingMaxPool.cpp /workspace/finn/cnpy/cnpy.cpp -I/workspace/finn/cnpy/ -I/workspace/finn/finn-hlslib -I/workspace/vivado-hlslib --std=c++11 -lz"""
process_compile = subprocess.Popen(bash_compile.split(), stdout=subprocess.PIPE)
process_compile.communicate()
bash_execute = "./execute_StreamingMaxPool"
process_execute = subprocess.Popen(bash_compile.split(), stdout=subprocess.PIPE)
process_execute.communicate()
temp_files.append("execute_StreamingMaxPool")
temp_files.append("output.npy")
output = np.load("output.npy")
for i in range(output.shape[0]):
print(np.transpose(output[i]))
## deleting temporary files
#for temp_file in temp_files:
# os.remove(temp_file)
sys.exit(0)
context[node.output[0]]=output
# deleting temporary files
for temp_file in temp_files:
os.remove(temp_file)
def get_attributes(self, node):
self.ImgDim = get_by_name(node.attribute, 'ImgDim').i
......
......@@ -77,4 +77,4 @@ def test_layer_streaming_maxpool():
input_dict = {"in": input_tensor}
output_dict = oxe.execute_onnx(model, input_dict)
print(output_dict[outp])
print(output_dict)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment