GithubHelp home page GithubHelp logo

toniz / tensorflow-cpp-example Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 5.0 114.95 MB

tensorflow cpp compile example using tensorflow.so. Don't need to install tensorflow.

License: MIT License

C++ 96.37% C 0.73% Makefile 0.42% Shell 0.01% Starlark 2.47%
tensorflow cpp compile

tensorflow-cpp-example's Introduction

tensorflow-cpp-example

tensorflow cpp compile example. Using tensorflow.so. can run without install tensorflow.


Compile Requirement

tensorflow.so is building in GCC5.4.0 and glibc-2.23

  • need GCC >=5.4.0
  • need GLIBC >= 2.23

Compile

  • g++ -std=c++11 -Iinclude -Llib test.cpp -ltensorflow_cc -o exec
  • g++ -std=c++11 -Iinclude -Llib label_image.cc -ltensorflow_cc -o label_image

Run

图片


GCC < 5.4.0 && GLIBC < 2.23

Insall GCC 5.4.0

sudo yum install libmpc-devel mpfr-devel gmp-devel
sudo yum install zlib-devel*
curl ftp://ftp.gnu.org/pub/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
tar xvfj gcc-5.4.0.tar.bz2    
cd gcc-5.4.0
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 8
sudo make install

found libstdc++.so.6.0.21 installed in your system.

Insall GLIBC 2.26

wget http://mirror.csclub.uwaterloo.ca/gnu/libc/glibc-2.26.tar.gz
tar -zxvf glibc-2.26.tar.gz 
mkdir glibc-build
cd glibc-build
../glibc-2.26/configure --prefix=/usr/lib64/glibc-2.26 
make -j 8
make install

found /usr/lib64/glibc-2.26/lib/libc.so installed

Compile

g++ -std=c++11 -Wl,-rpath='/usr/lib64/glibc-2.26/lib' -Wl,--dynamic-linker='/usr/lib64/glibc-2.26/lib/ld-linux-x86-64.so.2' -Iinclude -I'/usr/lib64/glibc-2.26/include' -Llib -L '/usr/lib64/glibc-2.26/lib' test.cpp -ltensorflow_cc -o exec 
g++ -std=c++11 -Wl,-rpath='/usr/lib64/glibc-2.26/lib' -Wl,--dynamic-linker='/usr/lib64/glibc-2.26/lib/ld-linux-x86-64.so.2' -Iinclude -I'/usr/lib64/glibc-2.26/include' -Llib -L '/usr/lib64/glibc-2.26/lib' label_image.cc -ltensorflow_cc -o label_image 

Run

export LD_LIBRARY_PATH=./lib:/usr/local/lib64/

图片

libstdc++.so.6.0.21 is in /usr/local/lib64/

tensorflow-cpp-example's People

Contributors

toniz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tensorflow-cpp-example's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.