-
-
Save jessebenson/c8ab4735bb3698c1f0303c089fb0ad79 to your computer and use it in GitHub Desktop.
Revisions
-
kmhofmann revised this gist
Feb 7, 2018 . 1 changed file with 8 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -105,15 +105,19 @@ necessary. * Leave out `--config=cuda` when not building with GPU support. * Due to [this issue](https://github.com/tensorflow/tensorflow/issues/15492), you might need to add the argument `--incompatible_load_argument_is_label=false` if you see an error similar to `name 'sycl_library_path' is not defined`. * TensorFlow 1.5: As [mentioned here](https://github.com/tensorflow/tensorflow/issues/16694), you might have to add `--action_env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}` to the call to Bazel, in case you encounter linking errors related to CUDA/cuDNN. * Add `-c dbg --strip=never` in case you do not want debug symbols to be stripped (e.g. for debugging purposes). Usually, you won't need to add this option. * Add `--compilation_mode=dbg` to build in debug instead of release mode, i.e. without optimizations. You shouldn't do this unless you really want to. * We still need to build a Python package using the now generated build_pip_package script. -
kmhofmann revised this gist
Jan 26, 2018 . 1 changed file with 28 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ The official instructions on building TensorFlow are here: https://www.tensorflo ## Prerequisites We are assuming a build with CUDA support, as well as including SIMD optimizations (SSE3, SSE4, AVX, AVX2, FMA), on a Debian-like system (e.g. Ubuntu Linux). On new systems, one will have to install CUDA, CuDNN, plus the following dependencies: @@ -21,7 +22,8 @@ Good to know: The compute capabilities for ## Installing Bazel Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. There are various ways to obtain a build of Bazel (see https://bazel.build/versions/master/docs/install-ubuntu.html). @@ -35,7 +37,10 @@ Recommended by Google, but you need to be comfortable adding another APT package ### Option 2: Building from source In case you prefer building from source, it's unfortunately not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be built with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. So we will go with building a distribution build, which is reasonably straightforward: @@ -44,15 +49,17 @@ So we will go with building a distribution build, which is reasonably straightfo $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.9.0-dist.zip * Compile Bazel $ bash ./compile.sh * The output executable is now located in `output/bazel`. Add a `PATH` entry to your `.bashrc`, or just export it in your current shell: $ export PATH=`pwd`/output:$PATH @@ -74,7 +81,8 @@ You should now be able to call the `bazel` executable from anywhere on your file $ deactivate * Clone the sources, and check out the desired branch. At the time of writing, 1.5.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow @@ -95,11 +103,17 @@ You should now be able to call the `bazel` executable from anywhere on your file $ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package * Leave out `--config=cuda` when not building with GPU support. * Add `-c dbg --strip=never` in case you do not want debug symbols to be stripped (e.g. for debugging purposes). Usually, you won't need to add this option. * Add `--compilation_mode=dbg` to build in debug instead of release mode, i.e. without optimizations. You shouldn't do this unless you really want to. * Due to [this issue](https://github.com/tensorflow/tensorflow/issues/15492), you might need to add the argument `--incompatible_load_argument_is_label=false` if you see an error similar to `name 'sycl_library_path' is not defined`. * We still need to build a Python package using the now generated build_pip_package script. @@ -115,9 +129,12 @@ That should be it! ### Notes on building with unsupported system * Additional steps may be necessary when building TensorFlow on an officially unsupported system (e.g. on a non-LTS Ubuntu version). For example, Ubuntu versions >16.04 ship with GCC 6 as default compiler, but CUDA 8 (still) requires a GCC compiler from the GCC 5.x series. In this case: * Build GCC 5.x from source and install, preferably user-local. (https://github.com/kmhofmann/build_stuff provides a script to build various versions of GCC from source.) Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: -
kmhofmann revised this gist
Jan 26, 2018 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,11 +74,11 @@ You should now be able to call the `bazel` executable from anywhere on your file $ deactivate * Clone the sources, and check out the desired branch. At the time of writing, 1.5.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout v1.5.0 * Run the configuration script @@ -107,7 +107,7 @@ You should now be able to call the `bazel` executable from anywhere on your file * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.5.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
Dec 21, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,14 +39,14 @@ In case you prefer building from source, it's unfortunately not as easy as cloni So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.9.0. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.9.0-dist.zip * Compile Bazel -
kmhofmann revised this gist
Dec 15, 2017 . 1 changed file with 32 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,18 +4,21 @@ The official instructions on building TensorFlow are here: https://www.tensorflo ## Prerequisites We are assuming a build with CUDA support, as well as including SIMD optimizations (SSE3, SSE4, AVX, AVX2, FMA), on a Debian-like system (e.g. Ubuntu Linux). On new systems, one will have to install CUDA, CuDNN, plus the following dependencies: $ sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel libcupti-dev (Leave out `libcupti-dev` when not building with GPU support.) Good to know: The compute capabilities for * Maxwell TITAN X: `5.2` * Pascal TITAN X (2016): `6.1` * GeForce GTX 1080 Ti: `6.1` (See [here](https://developer.nvidia.com/cuda-gpus) for the full list.) ## Installing Bazel Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. @@ -57,24 +60,20 @@ You should now be able to call the `bazel` executable from anywhere on your file ## Installing TensorFlow ### Building TensorFlow * Create a Python 3 virtualenv, if you have not done this yet. For example: $ virtualenv -p python3 --system-site-packages ~/.virtualenvs/tf_dev * Activate your respective Python 3 based virtual environment. $ source ~/.virtualenvs/tf_dev/bin/activate * This can later be deactivated with $ deactivate * Clone the sources, and check out the desired branch. At the time of writing, 1.4.1 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow @@ -112,4 +111,19 @@ You should now be able to call the `bazel` executable from anywhere on your file (Adjust the file name, if necessary.) That should be it! ### Notes on building with unsupported system * Additional steps may be necessary when building TensorFlow on an officially unsupported system (e.g. on a non-LTS Ubuntu version). For example, Ubuntu versions >16.04 ship with GCC 6 as default compiler, but CUDA 8 (still) requires a GCC compiler from the GCC 5.x series. In this case: * Build GCC 5.x from source and install, preferably user-local. (https://github.com/kmhofmann/build_stuff provides a script to build various versions of GCC from source.) Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: $ export PATH=$HOME/local/bin:$PATH $ export LD_LIBRARY_PATH=$HOME/local/lib64:$LD_LIBRARY_PATH Ensure that `gcc --version` is the desired version. * Proceed with building, as described below. -
kmhofmann revised this gist
Dec 15, 2017 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,11 +75,11 @@ You should now be able to call the `bazel` executable from anywhere on your file ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.4.1 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout v1.4.1 * Run the configuration script @@ -98,15 +98,17 @@ You should now be able to call the `bazel` executable from anywhere on your file Leave out `--config=cuda` when not building with GPU support. Add `-c dbg --strip=never` in case you do not want debug symbols to be stripped (e.g. for debugging purposes). Usually, you won't need to add this option. Add `--compilation_mode=dbg` to build in debug instead of release mode, i.e. without optimizations. You shouldn't do this unless you really want to. * We still need to build a Python package using the now generated build_pip_package script. $ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.4.1-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
Dec 14, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,7 +96,9 @@ You should now be able to call the `bazel` executable from anywhere on your file $ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package Leave out `--config=cuda` when not building with GPU support. Add `-c dbg --strip=never` in case you do not want debug symbols to be stripped (e.g. for debugging purposes). (Usually, you won't need to add this option.) * We still need to build a Python package using the now generated build_pip_package script. -
kmhofmann revised this gist
Nov 7, 2017 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,14 +36,14 @@ In case you prefer building from source, it's unfortunately not as easy as cloni So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.7.0. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.7.0/bazel-0.7.0-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.7.0-dist.zip * Compile Bazel @@ -70,16 +70,16 @@ You should now be able to call the `bazel` executable from anywhere on your file Ensure that `gcc --version` is the desired version. * Proceed with building, as described below. ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.4.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout v1.4.0 * Run the configuration script @@ -92,9 +92,9 @@ You should now be able to call the `bazel` executable from anywhere on your file * Compile TensorFlow using Bazel. This command will build Tensorflow using optimized settings for the current machine architecture. $ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package (Leave out `--config=cuda` when not building with GPU support.) @@ -104,7 +104,7 @@ You should now be able to call the `bazel` executable from anywhere on your file * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
Aug 17, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,14 +36,14 @@ In case you prefer building from source, it's unfortunately not as easy as cloni So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.5.3. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.5.3/bazel-0.5.3-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.5.3-dist.zip * Compile Bazel @@ -75,11 +75,11 @@ You should now be able to call the `bazel` executable from anywhere on your file ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.3.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout v1.3.0 * Run the configuration script @@ -104,7 +104,7 @@ You should now be able to call the `bazel` executable from anywhere on your file * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.3.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
Aug 17, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,7 +61,9 @@ You should now be able to call the `bazel` executable from anywhere on your file * Additional steps may be necessary when building TensorFlow on an officially unsupported system (e.g. on a non-LTS Ubuntu version). For example, Ubuntu versions >16.04 ship with GCC 6 as default compiler, but CUDA 8 (still) requires a GCC compiler from the GCC 5.x series. In this case: * Build GCC 5.x from source and install, preferably user-local. (https://github.com/kmhofmann/build_stuff provides a script to build various versions of GCC from source.) Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: $ export PATH=$HOME/local/bin:$PATH $ export LD_LIBRARY_PATH=$HOME/local/lib64:$LD_LIBRARY_PATH -
kmhofmann revised this gist
Jun 16, 2017 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,24 +24,26 @@ There are various ways to obtain a build of Bazel (see https://bazel.build/versi ### Option 1: Using the Bazel APT repository Recommended by Google, but you need to be comfortable adding another APT package souce. $ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list $ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - $ sudo apt-get update && sudo apt-get install bazel ### Option 2: Building from source In case you prefer building from source, it's unfortunately not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be built with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.5.1. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.5.1/bazel-0.5.1-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.5.1-dist.zip * Compile Bazel @@ -71,11 +73,11 @@ You should now be able to call the `bazel` executable from anywhere on your file ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.2.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout v1.2.0 * Run the configuration script @@ -100,7 +102,7 @@ You should now be able to call the `bazel` executable from anywhere on your file * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.2.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
May 2, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,8 +61,8 @@ You should now be able to call the `bazel` executable from anywhere on your file * Build GCC 5.x from source and install, preferably user-local. Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: $ export PATH=$HOME/local/bin:$PATH $ export LD_LIBRARY_PATH=$HOME/local/lib64:$LD_LIBRARY_PATH Ensure that `gcc --version` is the desired version. -
kmhofmann revised this gist
May 2, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ You should now be able to call the `bazel` executable from anywhere on your file ### Notes on building with unsupported system * Additional steps may be necessary when building TensorFlow on an officially unsupported system (e.g. on a non-LTS Ubuntu version). For example, Ubuntu versions >16.04 ship with GCC 6 as default compiler, but CUDA 8 (still) requires a GCC compiler from the GCC 5.x series. In this case: * Build GCC 5.x from source and install, preferably user-local. Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: @@ -71,7 +71,7 @@ You should now be able to call the `bazel` executable from anywhere on your file ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.1.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow -
kmhofmann revised this gist
May 2, 2017 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,6 +55,21 @@ You should now be able to call the `bazel` executable from anywhere on your file ## Installing TensorFlow ### Notes on building with unsupported system * Additional steps may be necessary when building TensorFlow on an officially unsupported system (e.g. on a non-LTS Ubuntu version). For example, Ubuntu versions >16.04 ship with GCC 6 as default compiler, but CUDA requires a GCC compiler from the GCC 5.x series. In this case: * Build GCC 5.x from source and install, preferably user-local. Add the respective paths to the `PATH` and `LD_LIBRARY_PATH` variables, e.g.: $ export PATH=%HOME/local/bin:$PATH $ export LD_LIBRARY_PATH=%HOME/local/lib64:$LD_LIBRARY_PATH Ensure that `gcc --version` is the desired version. * Proceed with building, as described below. In case of errors, you may need to apply [#9482](https://github.com/tensorflow/tensorflow/pull/9482), either by checking out a version >1.1.0 below (once released), building straight from the `master` branch, or applying the patch manually (it's small). ### Building TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.1 was the latest version; adjust if necessary. -
kmhofmann revised this gist
May 1, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,11 +56,11 @@ You should now be able to call the `bazel` executable from anywhere on your file ## Installing TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.1 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout r1.1 * Run the configuration script @@ -85,7 +85,7 @@ You should now be able to call the `bazel` executable from anywhere on your file * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.1.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) -
kmhofmann revised this gist
May 1, 2017 . 1 changed file with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,9 +20,17 @@ On new systems, one will have to install CUDA, CuDNN, plus the following depende Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. There are various ways to obtain a build of Bazel (see https://bazel.build/versions/master/docs/install-ubuntu.html). ### Option 1: Using the Bazel APT repository $ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list $ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - $ sudo apt-get update && sudo apt-get install bazel ### Option 2: Building from source I usually prefer building from source, but it's not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be built with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. So we will go with building a distribution build, which is reasonably straightforward: -
kmhofmann revised this gist
May 1, 2017 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,9 +60,8 @@ You should now be able to call the `bazel` executable from anywhere on your file You can leave most defaults, but do specify the following (or similar): CUDA support -> Y CUDA compute capability -> 5.2,6.1 * Compile TensorFlow using Bazel. -
kmhofmann revised this gist
Apr 16, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,14 +26,14 @@ I prefer building from source, but it's not as easy as cloning the Git repositor So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.4.5. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.4.5-dist.zip * Compile Bazel -
kmhofmann revised this gist
Apr 16, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ On new systems, one will have to install CUDA, CuDNN, plus the following depende Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. There are various ways to obtain a build of Bazel described here. One of the options is installing it via custom APT repository (see https://bazel.build/versions/master/docs/install-ubuntu.html), but I personally don't like adding all kinds of APT sources. I prefer building from source, but it's not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be built with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. -
kmhofmann revised this gist
Apr 10, 2017 . 1 changed file with 62 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,57 +4,82 @@ The official instructions on building TensorFlow are here: https://www.tensorflo ## Prerequisites We are assuming a build with CUDA support, as well as including SIMD optimizations (SSE3, SSE4, AVX, AVX2, FMA). Good to know: The compute capabilities for * Maxwell TITAN X: `5.2` * Pascal TITAN X (2016): `6.1` On new systems, one will have to install CUDA, CuDNN, plus the following dependencies: $ sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel libcupti-dev (Leave out `libcupti-dev` when not building with GPU support.) ## Installing Bazel Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. There are various ways to obtain a build of Bazel described here. One of the options is installing it via custom APT repository, but I personally don't like adding all kinds of APT sources. I prefer building from source, but it's not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be built with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. So we will go with building a distribution build, which is reasonably straightforward: * Download a distribution package from the releases page. The current version at the time of writing was 0.4.4. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-dist.zip * Unzip the sources. This being a zip file, the files are stored without containing folder. Glad we already put it in its own directory... $ unzip bazel-0.4.4-dist.zip * Compile Bazel $ bash ./compile.sh * The output executable is now located in `output/bazel`. Add a `PATH` entry to your `.bashrc`, or just export it in your current shell: $ export PATH=`pwd`/output:$PATH You should now be able to call the `bazel` executable from anywhere on your filesystem. ## Installing TensorFlow * Activate your respective Python 3 based virtual environment. * Clone the sources, and check out the desired branch. At the time of writing, 1.0 was the latest version; adjust if necessary. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout r1.0 * Run the configuration script $ ./configure You can leave most defaults, but do specify the following (or similar): jemalloc -> Y CUDA support -> Y CUDA compute capability -> 5.1,6.1 * Compile TensorFlow using Bazel. I got the special build options from here: http://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions $ bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package (Leave out `--config=cuda` when not building with GPU support.) * We still need to build a Python package using the now generated build_pip_package script. $ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg * Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.0.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) That should be it! -
kmhofmann created this gist
Apr 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ # Building TensorFlow from source The official instructions on building TensorFlow are here: https://www.tensorflow.org/install/install_sources ## Prerequisites We are assuming a build with CUDA support, and compute capabilities 5.2 (Maxwell TITAN X) and 6.1 (Pascal TITAN X), as well as including SIMD optimizations (SSE3, SSE4, AVX, AVX2, FMA). Good to know: The compute capabilities for On new systems, one will have to install CUDA, CuDNN, plus the following dependencies: $ sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel libcupti-dev (Leave out libcupti-dev when not building with GPU support.) ## Installing Bazel Bazel is Google's own build system, required to build TensorFlow. Building TensorFlow usually requires an up-to-date version of Bazel; there is a good chance that whatever your package manager provides will be outdated. There are various ways to obtain a build of Bazel described here. One of the options is installing it via custom APT repository, but I (Michael) personally don't like adding all kinds of APT sources. I prefer building from source, but it's not as easy as cloning the Git repository and typing `make`. Recent versions of Bazel can only be build with Bazel, unless one downloads a distribution source build, which contains some already pre-generated files. With one such installation in place, one could build Bazel straight from the repository source, but that's probably not necessary. So we will go with building a distribution build, which is straightforward: Download a distribution package from the releases page. The current version at the time of writing was 0.4.4. $ mkdir bazel && cd bazel $ wget https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-dist.zip Unzip the sources. This being a zip file, the files are stored without containing folder. (sad) Glad we put it in its own directory... $ unzip bazel-0.4.4-dist.zip Compile Bazel $ bash ./compile.sh The output executable is now located in output/bazel. Add a PATH entry to your .bashrc, or just export it in your current shell: $ export PATH=`pwd`/output:$PATH You should now be able to call the bazel executable from anywhere on your filesystem. ## Installing TensorFlow Activate your respective Python 3 based virtual environment! Clone the sources, and check out the desired branch. At the time of writing, 1.0 was the latest version. $ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout r1.0 Run the configuration script $ ./configure You can leave most defaults, but do specify the following: jemalloc -> Y CUDA support -> Y CUDA compute capability -> 5.1,6.1 Compile TensorFlow using Bazel. I got the special build options from here. $ bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package (Leave out --config=cuda when not building with GPU support.) We still need to build a Python package using the now generated build_pip_package script. $ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg Now there will be a package inside /tmp/tensorflow_pkg, which can be installed with pip. $ pip install /tmp/tensorflow_pkg/tensorflow-1.0.0-cp35-cp35m-linux_x86_64.whl (Adjust the file name, if necessary.) That should be it!