tensorflow build source shell __ for centos

来源:互联网 发布:淘宝店铺重新开店 编辑:程序博客网 时间:2024/06/08 09:21

from:

http://www.ehu.eus/ehusfera/hpc/2016/04/07/installing-tensorflow-0-7-in-red-hat-enterprise-linux-server-6-4-with-gpus/comment-page-1/

http://blog.csdn.net/mafeiyu80/article/details/51397795

http://blog.abysm.org/2016/06/building-tensorflow-centos-6/


# centos tensorflow compile
# =========================================================================
#1 install basic tools
yum -y install unzip git-all pkg-config zip g++ zlib1g-dev zlib-devel

# =========================================================================
#install jdk8
yum remove java-1.6.0-openjdk
yum remove java-1.7.0-openjdk

download "http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" jdk-8u101-linux-x64.tar.gz
cp jdk-8u101-linux-x64.tar.gz /opt
tar -xvf jdk-8u101-linux-x64.tar.gz
cd jdk1.8.0_101/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_101/bin/java 2
alternatives --config java
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_101/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_101/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_101/bin/jar
alternatives --set javac /opt/jdk1.8.0_101/bin/javac
export JAVA_HOME=/opt/jdk1.8.0_101
export JRE_HOME=/opt/jdk1.8.0_101/jre
export PATH=$PATH:/opt/jdk1.8.0_101/bin:/opt/jdk1.8.0_101/jre/bin

# =========================================================================
# Maybe:
# update dev-tools
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
# Install the collection:
sudo yum install devtoolset-3
# Start using software collections:
scl enable devtoolset-3 bash
echo "source /opt/rh/devtoolset-3/enable" >> ~/.bashrc
sudo yum list devtoolset-3\*

# =========================================================================
# install bazel version 0.2.2
wget https://goo.gl/OQ2ZCl -O bazel-installer-linux-x86_64.sh
chmod +x bazel-installer-linux-x86_64.sh
sudo ./bazel-installer-linux-x86_64.sh
rm bazel-installer-linux-x86_64.sh
sudo chown $USER:$USER ~/.cache/bazel/

# =========================================================================
# install python deps
??? yum -y install swig
??? yum install python-devel python-nose python-setuptools

??? yum -y install numpy python-devel scipy

??? sudo yum -y install epel-release
??? yum -y install python-pip
??? yum install python-wheel
??? sudo pip install numpy

# =========================================================================

# !!!IMPORTANT: Just use python2.7, Don't need update here!!!

#

# update python 3.5.1
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar -xvf Python-3.5.1.tgz
cd Python-3.5.1
./configure
make
sudo make install
cd ../
rm Python-3.5.1.tgz
sudo echo "alias python=python3.5" >> ~/.bashrc
source ~/.bashrc

# =========================================================================
echo -e "\e[36m***Cloning TensorFlow from GitHub*** \e[0m"
git clone --recurse-submodules -b r0.8 https://github.com/tensorflow/tensorflow.git
sed -i 's/kDefaultTotalBytesLimit = 64/kDefaultTotalBytesLimit = 128/' tensorflow/google/protobuf/src/google/protobuf/io/coded_stream.h
./configure

bazel --output_base=/search/ted/ypzhang/workspace/bazel/output --output_user_root=/search/ted/ypzhang/workspace/bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

bazel --output_base=/search/ted/ypzhang/workspace/bazel/output --output_user_root=/search/ted/ypzhang/workspace/bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

bazel-bin/tensorflow/tools/pip_package/build_pip_package /search/ted/ypzhang/workspace/tf_whl/tensorflow.pkg

pip install /search/ted/ypzhang/workspace/tf_whl/tensorflow.pkg/*


# =========================================================================

# fix protobuf 64M limit

pip uninstall protobuf
cd google/protobuf
./autogen.sh
./configure
make
make check
sudo make install

Then update your LD_LIBRARY_PATH as it says in google/protobuf/src/README.md
Then

cd python
python setup.py build --cpp_implementation
python setup.py test --cpp_implementation
sudo python setup.py install --cpp_implementation

By default, the package will be installed to /usr/local. However, on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. You can add it

bazel build -c opt --config=cuda --define=use_fast_cpp_protos=true //tensorflow/tools/pip_package:build_pip_packagebazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg/pip install --no-cache-dir --upgrade /tmp/tensorflow_pkg/tensorflow-0.8.0-py2-none-any.whl///==============================================1 cannt find gcc: unset CC  export TF_NEED_OPENCL=0  export TF_NEED_GCP=0  export TF_NEED_HDFS=0  export TF_NEED_CUDA=1  ./configure2 bazel --output_base=/search/odin/ypzhang/workspace/bazel/output --output_user_root=/search/odin/ypzhang/workspace/bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer  
 
0 0
原创粉丝点击