Tensorflow v1.2.x

De Wiki de Calcul Québec
Aller à : Navigation, rechercher

Helios

 #!/bin/bash
set -e
module purge -f
module load compilers/gcc/4.8.5 compilers/java/1.8 apps/buildtools cuda/8.0.44 libs/cuDNN/6 compilers/swig apps/git apps/bazel/0.4.5
 
OPWD=$(pwd)
TF_COMPILE_PATH=/tmp/${USER}_$(date +'%s')
BAZEL_ROOT_PATH=$TF_COMPILE_PATH/bazel
mkdir -p $TF_COMPILE_PATH; cd $TF_COMPILE_PATH
git clone https://github.com/tensorflow/tensorflow.git; cd tensorflow
git checkout v1.2.0
 
GCC_PREFIX=$(dirname $(dirname $(which gcc)))
sed -i "\;linker_flag: \"-B/usr/bin/\";a \ \ linker_flag: \"-Wl,-rpath=$GCC_PREFIX/lib64\"" third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl
sed -i "\;linker_flag: \"-B/usr/bin/\";a \ \ linker_flag: \"-Wl,-rpath=$GCC_PREFIX/lib\"" third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl
sed -i "/cmd = 'PATH=' + PREFIX_DIR + ' ' + cmd/s/^/#/" third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
sed -i -r "s;bazel (clean|fetch|query); bazel --output_user_root=$BAZEL_ROOT_PATH \1;g" configure
sed -i -r "s;^_VERSION = '(.+)'$;_VERSION = '\1+helios';g" tensorflow/tools/pip_package/setup.py
 
module load apps/python/3
pyvenv buildenv
source buildenv/bin/activate
pip install numpy wheel
 
export MALLOC_ARENA_MAX=4
 
export \
PYTHON_BIN_PATH=$(which python) \
USE_DEFAULT_PYTHON_LIB_PATH=1 \
TF_NEED_GCP=0 \
TF_NEED_HDFS=0 \
TF_NEED_OPENCL=0 \
TF_NEED_CUDA=1 \
TF_NEED_JEMALLOC=0 \
TF_ENABLE_XLA=0 \
GCC_HOST_COMPILER_PATH=$(which gcc) \
TF_CUDA_VERSION=8.0 \
CUDA_TOOLKIT_PATH=$CUDA_HOME \
TF_CUDNN_VERSION=6 \
CUDNN_INSTALL_PATH="/software-gpu/libs/cuDNN/6_cuda8.0" \
TF_CUDA_COMPUTE_CAPABILITIES="3.5,3.7" \
CC_OPT_FLAGS="-march=native"
./configure
 
bazel --output_user_root=$BAZEL_ROOT_PATH build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
 
mkdir dist; bazel-bin/tensorflow/tools/pip_package/build_pip_package $PWD/dist
cp dist/*.whl $OPWD
bazel --output_user_root=$BAZEL_ROOT_PATH shutdown
cd
rm -rf $TF_COMPILE_PATH
Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Ressources de Calcul Québec
Outils
Partager