ehw-fit / tf-approximate

Approximate layers - TensorFlow extension
MIT License
26 stars 11 forks source link

[tf1] fatal error: 'tensorflow/core/framework/op_kernel.h' file not found #3

Closed johnzhou1996 closed 4 years ago

johnzhou1996 commented 4 years ago

Hi, my name is John Zhou. I really appreciate that you could open source. When I ran the Makefile in the tf1 fold, there was a error as follow:

(tensorflow) zhouhang@zhouhangdeMacBook-Pro axqconv % make                     
(echo "//automatically generated by makefile" ; cat axmult/mul8u_125K.c axmult/mul8u_12N4.c axmult/mul8u_13QR.c axmult/mul8u_1446.c axmult/mul8u_14VP.c axmult/mul8u_150Q.c axmult/mul8u_17C8.c axmult/mul8u_17KS.c axmult/mul8u_17QU.c axmult/mul8u_185Q.c axmult/mul8u_18DU.c axmult/mul8u_199Z.c axmult/mul8u_19DB.c axmult/mul8u_1AGV.c axmult/mul8u_1JFF.c axmult/mul8u_2AC.c axmult/mul8u_2HH.c axmult/mul8u_2P7.c axmult/mul8u_7C1.c axmult/mul8u_96D.c axmult/mul8u_CK5.c axmult/mul8u_DM1.c axmult/mul8u_EXZ.c axmult/mul8u_FTA.c axmult/mul8u_GS2.c axmult/mul8u_JQQ.c axmult/mul8u_JV3.c axmult/mul8u_KEM.c axmult/mul8u_L40.c axmult/mul8u_NGR.c axmult/mul8u_PKY.c axmult/mul8u_QJD.c axmult/mul8u_QKX.c axmult/mul8u_Y48.c axmult/mul8u_YX7.c axmult/mul8u_ZFB.c) > axmult.cc
python generate_header.py axmult.cc > axmult.h
g++ -std=c++11 -Wno-ignored-attributes -shared axqconv.cc axmult.cc -o axqconv.so -fPIC   -O2
axqconv.cc:25:10: fatal error: 'tensorflow/core/framework/op_kernel.h' file not
      found
#include "tensorflow/core/framework/op_kernel.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [axqconv.so] Error 1

I think that maybe the version of tensorflow or install environment result in the error. Anaconda + Python3.7 + Tensorflow2.1 is my environment. And I checked out the path, /Users/zhouhang/Anaconda3/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_core/core/framework, op_kernel.h could not be found. Could you tell me how you build your environment, including python version, tensorflow version and so on. Thank you so much.

mrazekv commented 4 years ago

Hi John, this version was written for TensorFlow 1 (1.14, but it is working even in version 1.15). If you need to use TF 2.0, please use GPU version (distributed as a Singularity image).

tensorflow                1.15.0          gpu_py37h0f0df58_0
tensorflow-base           1.15.0          gpu_py37h9dcbed7_0
tensorflow-estimator      1.15.1             pyh2649769_0

Did it help?

johnzhou1996 commented 4 years ago

thanks, I'll try again.

johnzhou1996 commented 4 years ago

Hi, My enviroment is ubuntu16.04 with anaconda3(python3.7, tf1.15). I've found the op_kernel.h in my enviroment. The path is /anaconda3/envs/tf1_15/lib/python3.7/site-packages/tensorflow_core/include/tensorflow/core/framework/op_kernel.h. Then I copy all the file in tf1/axqconv into the path, /anaconda3/envs/tf1_15/lib/python3.7/site-packages/tensorflow_core/include/, and run the Makefile.But there is another error as follow: (tf1_15) zhouhang@ubuntu:/anaconda3/envs/tf1_15/lib/python3.7/site-packages/tensorflow_core/include$ make g++ -o tables tables.cc axmult.o In file included from /usr/include/c++/5/cstdint:35:0, from approximate_selector.h:2, from tables.cc:7: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

error This file requires compiler and library support

^ Makefile:27: recipe for target 'tables' failed make: *** [tables] Error 1 Perhaps, the g++'s version cause the error. In my machine, gcc version is 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu116.04.12) .

johnzhou1996 commented 4 years ago

4

I modified two lines of code in the Makefile by adding the -std=c++11 as follow: tune: tune.o axmult.o g++ -std=c++11 -o $@ $^

tables: tables.cc axmult.o approximate_selector.h g++ -std=c++11 -o $@ $(filter-out %.h, $^) Then run the Makefile, and axqconv.so is generated successfully. Does it result in bad outcome?

mrazekv commented 4 years ago

You can try to run

make clean

To delete file .tfconfig, where the configuration for TensorFlow extension building is cached. If you changed your TF version using different Anaconda environment, the build arguments may change.

johnzhou1996 commented 4 years ago

thank you.