yaroslavvb / tensorflow-community-wheels

Place to upload links to TensorFlow wheels
452 stars 35 forks source link

TF 1.14.0 GPU (CUDA 10.0 cuDNN 7.4) without AVX, Ubuntu 16.04, Python 3.6 [from official docker image] #120

Open saippuakauppias opened 5 years ago

saippuakauppias commented 5 years ago

Builded from official docker devel-gpu-py3 image:

# pull docker image
docker pull tensorflow/tensorflow:devel-gpu-py3
mkdir -p ~/projects/tf

# run docker
docker run --gpus all -it  -v ~/projects/tf:/my-devel tensorflow/tensorflow:devel-gpu-py3 bash

# fix bazel version
rm -rf /usr/local/bin/bazel
wget -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh"
chmod +x /bazel/installer.sh
/bazel/installer.sh

# go to TF folder
cd /tensorflow_src
git checkout v1.14.0

# set some variables
# see full in Dockerfile: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/devel-gpu.Dockerfile
export TF_ENABLE_XLA=1
export CC_OPT_FLAGS="-march=native -mno-avx"

# yes to all (enter, enter, enter, ...)
./configure

# run compilation
bazel build --config=opt --config=cuda --noincompatible_strict_action_env //tensorflow/tools/pip_package:build_pip_package

# get wheel
bazel-bin/tensorflow/tools/pip_package/build_pip_package /my-devel/tensorflow_pkg1

Builded wheel: https://drive.google.com/open?id=14qpvB9aLD24reT70WDgrkNXpwawRnpaf

gritsay commented 4 years ago

This is Dockerfile for above builded wheel without AVX / AVX2 support with Jupiter noterbook system.

FROM tensorflow/tensorflow:1.15.0-gpu-py3

RUN apt-get install -y \ build-essential \ curl \ git \ wget \ swig

RUN wget -c -O tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whl "!!! PATH_FOR_TENSORWLOW_ABOVE_BULDED WHEEL !!!" # remove preinstalled tensorflow with AVX support RUN pip uninstall --yes tensorflow-gpu # install custom build tensorwlow without AVX / AVX2 support RUN pip install tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whl

RUN pip --no-cache-dir install \ Pillow \ h5py \ keras_applications \ keras_preprocessing \ matplotlib \ mock \ numpy \ scipy \ sklearn \ pandas \ future \ portpicker \ enum34

RUN pip install jupyter matplotlib RUN pip install jupyter_http_over_ws RUN jupyter serverextension enable --py jupyter_http_over_ws

RUN mkdir -p /tf/tensorflow-tutorials && chmod -R a+rwx /tf/ RUN mkdir /.local && chmod a+rwx /.local RUN apt-get install -y --no-install-recommends wget WORKDIR /tf/tensorflow-tutorials RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/classification.ipynb RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/overfit_and_underfit.ipynb RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/regression.ipynb RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/save_and_load.ipynb RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/text_classification.ipynb RUN wget https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/keras/text_classification_with_hub.ipynb RUN apt-get autoremove -y && apt-get remove -y wget WORKDIR /tf EXPOSE 8888

RUN python3 -m ipykernel.kernelspec CMD ["bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root"]

So, need to assemble a container.

docker build -t "tensorflow_gpu:dockerfile" .

and start it

docker run -p 8888:8888 --rm --gpus all -it tensorflow_gpu:dockerfile

voila..)