Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling pyxir error in py_base.cpp with std::regex_replace #34

Closed
danlg opened this issue Mar 26, 2021 · 5 comments
Closed

Compiling pyxir error in py_base.cpp with std::regex_replace #34

danlg opened this issue Mar 26, 2021 · 5 comments

Comments

@danlg
Copy link

danlg commented Mar 26, 2021

Hi

Trying to compile pyxir (commit 7d73925, Version bump to v0.1.6), I get the error:

[ 4%] Building CXX object CMakeFiles/pyxir.dir/src/pyxir/ffi/py_base.cpp.o
In file included from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26:0,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp: In function ‘std::string pyxir::stringify(const string&)’:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp:37:55: error: no matching function for call to ‘regex_replace(const string&, std::regex&, const char [2])’
std::string s2 = std::regex_replace(s, vowel_re, "-");

The command "sudo python3 setup.py install" failed so I tried the direct command
"cmake --build . --config Release" to get more details. Same issue than py_base.cpp:23: with frontend/onnx.cpp:23

Please advise.

Details below:


$ cmake --configure .
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.8", minimum required is "3.6")
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.8")
-- Found PythonLibs: python3.6m
-- pybind11 v2.4.dev4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/centos/pyxir


$ cmake --build . --config Release
[ 4%] Building CXX object CMakeFiles/pyxir.dir/src/pyxir/ffi/py_base.cpp.o
In file included from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26:0,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp: In function ‘std::string pyxir::stringify(const string&)’:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp:37:55: error: no matching function for call to ‘regex_replace(const string&, std::regex&, const char [2])’
std::string s2 = std::regex_replace(s, vowel_re, "-");
^
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp:37:55: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
from /home/centos/pyxir/include/pyxir/graph/../common/util.hpp:21,
from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed:
In file included from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26:0,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp:37:55: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex’ and ‘const char*’)
std::string s2 = std::regex_replace(s, vowel_re, "-");
^
In file included from /usr/include/c++/4.8.2/regex:62:0,
from /home/centos/pyxir/include/pyxir/graph/../common/util.hpp:21,
from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(const basic_string<_Ch_type>& __s,
^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed:
In file included from /home/centos/pyxir/include/pyxir/graph/xgraph.hpp:26:0,
from /home/centos/pyxir/include/pyxir/pyxir.hpp:21,
from /home/centos/pyxir/src/pyxir/ffi/py_base.cpp:23:
/home/centos/pyxir/include/pyxir/graph/../common/util.hpp:37:55: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char [2]’
std::string s2 = std::regex_replace(s, vowel_re, "-");
^
gmake[2]: *** [CMakeFiles/pyxir.dir/src/pyxir/ffi/py_base.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/pyxir.dir/all] Error 2
gmake: *** [all] Error 2

@jtuyls
Copy link

jtuyls commented Mar 26, 2021

Hi @danlg , what system are you compiling on? Could you try with a gcc version >= 5? It looks like regex wasn't fully supported yet in 4.8 and the regex_replace function is missing (https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions).

@danlg
Copy link
Author

danlg commented Apr 7, 2021

thanks @jtuyls . Went further but still getting issue with

$ cmake --build . --config Release
Scanning dependencies of target pyxir
[ 4%] Building CXX object CMakeFiles/pyxir.dir/src/pyxir/runtime/backends/vai_rt/vai_api/dpu_func.cpp.o
In file included from /home/centos/pyxir/src/pyxir/runtime/backends/vai_rt/vai_api/dpu_func.cpp:23:0:
/home/centos/pyxir/src/pyxir/runtime/backends/vai_rt/vai_api/dpu_func.hpp:20:10: fatal error: dpu_runner.hpp: No such file or directory
#include <dpu_runner.hpp>

Can't find dpu_runner.hpp anywhere in /opt/Xilinx... nor in pyxir

@jtuyls
Copy link

jtuyls commented Apr 13, 2021

@danlg In which environment are you building pyxir (and which docker if you are compiling it on a x86 machine) and what DPU are you targeting? PyXIR is looking for a dpu_runner.hpp but it can't be found so I expect this to be an environment issue.

@danlg
Copy link
Author

danlg commented Apr 14, 2021

thanks @jtuyls

I am targeting AWS F1 python3 setup.py install --use_vai_rt_dpucadx8g --user
I had to change vitisai_INCLUDE_DIRS and upgrade gcc compiler
`#set(vitisai_INCLUDE_DIRS ${vitisai_ROOT_DIR}/lib/python3.6/site-packages/vai/dpuv1/rt/vitis/include/dpu)
set(vitisai_INCLUDE_DIRS ${vitisai_ROOT_DIR}/tools/Vitis-AI-Runtime/VART/vart/runner/include)

Overall, I am disappointed by the low build quality of the project and documentation (Xilinx in general and pyxir in particular) and the unnecessary complexity. We are talking of something very basic here that is to say building the library. The amount of effort to get it built is very high and build instruction should be much more straightforward with documentation on the supported platform. If Xilinx does not support Centos 7.9 (the default of AWS FPGA Developer AMI) just indicate it. It will save a lot of time to everyone.

Now the latest error I get is:

''-- Build files have been written to: /home/centos/pyxir/build/temp.linux-x86_64-3.8
gmake[2]: *** No rule to make target '/home/centos/vitis-ai/lib/libxfdnn.so', needed by '../lib.linux-x86_64-3.8/libpyxir.so'. Stop.''

But the doc of Vitis AI says xfDNN is deprecated, ml-suite archived (formerly known as xfDNN) Xilinx/ml-suite#127 , replaced by DPU-V1 /Vitis

where can I find the lib libxfdnn.so ?

The lib was found by downloading https://github.com/Xilinx/ml-suite/blob/master/xfdnn/rt/libs/libxfdnn.so

and I managed to link and finally build. Aleluihah. I still believe the build is highly complex, error prone and not well documented.

@jtuyls
Copy link

jtuyls commented Apr 15, 2021

@danlg Pyxir is meant to be built inside the the Vitis AI docker which contains all necessary packages to quantize, compile and run. Pyxir is not meant to be a standalone package that contains all necessary Vitis AI tools and therefore it won't build out-of-the-box in an environment that doesn't contain those tools. That's why Pyxir couldn't find the necessary header files and the libxfdnn package.

It looks to me like you are not using the Vitis AI - Pyxir docker images and instead are trying to put everything together from scratch? This is not documented because it's not meant to be done and so I advise to use the preprovided flows and docker images. For TVM you can have a look here: https://tvm.apache.org/docs/deploy/vitis_ai.html, for ONNX Runtime: https://www.onnxruntime.ai/docs/reference/execution-providers/Vitis-AI-ExecutionProvider.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants