2017-02-20 62 views
0

我正在尝试按照本指南从源代码构建TensorFlow:Installing TensorFlow from Sources。该版本似乎工作正常,但接下来是最后一步:Bazel存储TenserFlow构建在哪里?

调用pip install来安装该pip软件包。 .whlfile的文件名取决于您的平台。例如,下面的命令 将在Linux上安装的PIP封装TensorFlow 1.0.0:

sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.0-py2-none-any.whl 

我想,如果你运行Linux这是伟大的,但我会理解,因为在Mac OS X中的位置好。

Mac上存储的包在哪里?我找不到它int /tmp,也不/Users/Library/Caches。而且由于Mac上的搜索功能被破坏,我的运气不佳。

+0

你是哪个包,通过'pip install'安装的?如果你安装了那个,那么它很可能在'/ Library/Python/2.7/site-packages'中(这通常是'pip'在'macOS/OS X'上存储它的包的地方)。 –

+0

'find〜-name'tensorflow-1.0.0-py2-none-any.whl''应该显示位置。您可能需要将搜索位置从'〜'更改为'/ tmp'或'/'。 – jww

回答

1

下面是我用建立在MacOS

先决条件

  • 安装巴泽勒
  • 安装CUDA 8.0
  • 克隆tensorflow程序到〜/ git的/ tensorflow

Then

cd ~/git/tensorflow 
git fetch --all 
brew upgrade bazel 

git stash 
git rebase tf/master 
git stash pop 

# to resolve conflict from previous ./configure run 
git checkout --theirs -- tensorflow/core/platform/default/build_config.bzl 

# do the actual build in TMUX session to avoid losing state when closing terminal 
tmux new-session -s bazel -n 0 
cd ~/git/tensorflow 

./configure 

export CUDA_VISIBLE_DEVICES= 
export CUDA_HOME=/usr/local/cuda 
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib 
export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH 
export PATH=$DYLD_LIBRARY_PATH:$PATH 

export date=feb11 
export tag=head 
export flags="--config=cuda --config=opt -k --action_env PATH --action_env DYLD_LIBRARY_PATH --action_env LD_LIBRARY_PATH" 

bazel build $flags -k //tensorflow/tools/pip_package:build_pip_package 
rm -Rf /tmp/tensorflow_pkg 
mkdir /tmp/tensorflow_pkg 
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg 

mkdir -p ~/g/tfbins/$date.$tag 
cp `find /tmp/tensorflow_pkg -type f ` ~/tfbins/$date.$tag 

这将降低你的车轮文件到~/tfbins/feb11.head 您可以通过使用类似 https://github.com/yaroslavvb/stuff/blob/master/configure_tf.sh

注意自动./configure部分,在Mac OS CUDA建筑物与最新巴泽勒发布打破,现在,你需要降级到0.4 0.3或从头脑中建立巴泽勒如果你想CUDA - https://github.com/tensorflow/tensorflow/issues/7227

然后,您可以这样公开分享车轮(设置的gsutil第一,选择不同的$桶)

export wheel=`find ~/tfbins/$date.$tag -type f` 
export basename=`find ~/tfbins/$date.$tag -type f -printf "%f\n"` 
cd ~/tfbins/$date.$tag 
fullname=$date.$tag.$basename 
ln -s $basename $fullname 
export bucket=tensorflow-community-wheels 
gsutil cp $fullname gs://$bucket 
gsutil acl set public-read gs://$bucket/$fullname 

echo https://storage.cloud.google.com/$bucket/$fullname 

然后分享从最后一行打印的链接到https://github.com/yaroslavvb/tensorflow-community-wheels :)

2

这听起来像你可能跳过了一步。巴泽尔不创建这个文件。 Bazel制作的节目。

https://www.tensorflow.org/install/install_sources现有步骤你提到的一个是运行

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg 

指定的第二个参数放在哪里轮文件。此外,该程序记录其输出目录:

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg 
Mon Feb 20 22:08:08 EST 2017 : === Using tmpdir: /var/folders/yt/9r8s598x603bx58zq85yrx680096yv/T/tmp.XXXXXXXXXX.gp5oIM0Z 
Mon Feb 20 22:08:13 EST 2017 : === Building wheel 
Mon Feb 20 22:08:45 EST 2017 : === Output wheel file is in: /tmp/tensorflow_pkg 
$ ls /tmp/tensorflow_pkg/ 
tensorflow-1.0.0-cp27-cp27m-macosx_10_12_intel.whl