The core templates do not include the required cstdint for non-float inputs
What commit version of aidge do you use
aidge_backend_cpu==0.6.1
aidge_core==0.6.2
aidge_export_cpp==0.3.1
Problem description
The benchmarking method aidge_export_cpp.benchmark.compute_output(...)
fails with integer inputs as the generated files (forward.hpp
) reference fixed-sized integers, but do not include their definition (csdtint
). As this is not a dependency that is visible to the end-user, it probably should be added automatically.
Also the compilation step, in the benchmarking method, should probably check the output of make
(it tries executing the compiled binary even if the compilation failed).
Here is the output of the example code
Context: Consumer node Add (Add#0) input #0
[WARNING] - No producer node attached to input#0 for node Add (Add)
Context: Consumer node Add (Add#0) input #1
[WARNING] - No producer node attached to input#1 for node Add (Add)
Context: Consumer node Add (Add#0) input #0
[WARNING] - No producer node attached to input#0 for node Add (Add)
Context: Consumer node Add (Add#0) input #1
[WARNING] - No producer node attached to input#1 for node Add (Add)
│ Generating export... ok
│ Compiling... ok
In file included from main.cpp:4:
./dnn/include/forward.hpp:9:27: error: ‘int64_t’ does not name a type
9 | void model_forward (const int64_t* Add_input_0,const int64_t* Add_input_1,
| ^~~~~~~
./dnn/include/forward.hpp:1:1: note: ‘int64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
+++ |+#include <cstdint>
1 | #ifndef DNN_HPP
./dnn/include/forward.hpp:9:54: error: ‘int64_t’ does not name a type
9 | void model_forward (const int64_t* Add_input_0,const int64_t* Add_input_1,
| ^~~~~~~
./dnn/include/forward.hpp:9:54: note: ‘int64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
main.cpp: In function ‘int main()’:
main.cpp:21:19: error: cannot convert ‘const int64_t*’ {aka ‘const long int*’} to ‘const int*’
21 | model_forward(Add_input_0, Add_input_1, &Add_output_0);
| ^~~~~~~~~~~
| |
| const int64_t* {aka const long int*}
./dnn/include/forward.hpp:9:36: note: initializing argument 1 of ‘void model_forward(const int*, const int*, float**)’
9 | void model_forward (const int64_t* Add_input_0,const int64_t* Add_input_1,
| ~~~~~~~~~~~~~~~^~~~~~~~~~~
make: *** [Makefile:23: build/./main.o] Error 1
Traceback (most recent call last):
File "./aidge_export_acetone/aidge_export_acetone/tests/export_acetone_add.py", line 25, in <module>
s = aidge_export_cpp.benchmark.compute_output(model, inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./aidge_export_acetone/.venv/lib/python3.11/site-packages/aidge_export_cpp/benchmark.py", line 113, in compute_output
output_str: str = run(f'./{folder_name}/bin/run_export', capture_output=True, text=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './add_test_export_cpp/bin/run_export'
Reproducible example code
import aidge_backend_cpu # noqa: F401
import aidge_core as ai
import aidge_export_cpp
import numpy as np
if __name__ == "__main__":
add_layer = ai.Add("Add")
model = ai.sequential([add_layer])
# Set backend and datatype
model.set_backend("cpu")
model.set_datatype(ai.dtype.float32)
scheduler = ai.SequentialScheduler(model)
inputs = [
("??", np.arange(1)),
("??", np.arange(2))
]
s = aidge_export_cpp.benchmark.compute_output(model, inputs)
print(s)