Tensorflow v0.11.x

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

Helios


module purge -f
module load compilers/gcc/4.8.5 compilers/java/1.8 apps/buildtools \
cuda/7.5 libs/cuDNN/5 compilers/swig apps/git apps/bazel/0.3.0

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow

git checkout v0.11.0 # change version if needed

cp third_party/gpus/crosstool/CROSSTOOL.tpl{,.orig}
for tool in gcc cpp gcov ar ld dwp nm objdump objcopy strip; do
    sed -i "s;/usr/bin/$tool;$(which $tool);g" third_party/gpus/crosstool/CROSSTOOL.tpl
done

GCC_PREFIX=$(dirname $(dirname $(which gcc)))
sed -i "\;linker_flag: \"-B/usr/bin/\";a \
\ \ linker_flag: \"-Wl,-rpath=$GCC_PREFIX/lib\"" third_party/gpus/crosstool/CROSSTOOL.tpl
sed -i "\;linker_flag: \"-B/usr/bin/\";a \
\ \ linker_flag: \"-Wl,-rpath=$GCC_PREFIX/lib64\"" third_party/gpus/crosstool/CROSSTOOL.tpl

for path in $(find $GCC_PREFIX -name include\*) ${CPATH//:/ }; do
    sed -i "\;cxx_builtin_include_directory: \"/usr/local/include\"; a \
\ \ cxx_builtin_include_directory: \"$path\"" third_party/gpus/crosstool/CROSSTOOL.tpl
done

sed -i "s;-B/usr/bin;-B$(dirname $(which ar));g" third_party/gpus/crosstool/CROSSTOOL.tpl

module load apps/python/2
virtualenv buildenv
source buildenv/bin/activate
pip install numpy wheel

sed -i "1 s;^.*$;#!$VIRTUAL_ENV/bin/python;" \
third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
sed -i "/cmd = 'PATH=' + PREFIX_DIR + ' ' + cmd/s/^/#/" \
third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
 
sed -i "s;'protobuf == 3.0.0b2';'protobuf == 3.0.2';g" tensorflow/tools/pip_package/setup.py

echo -e "\nN\nN\n\nY\n\n7.5\n/software-gpu/cuda/7.5.18\n5\n/software-gpu/libs/cuDNN/5_cuda7.5\n3.5,3.7\n" \
| MALLOC_ARENA_MAX=4 ./configure

MALLOC_ARENA_MAX=4 bazel 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

deactivate


Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Ressources de Calcul Québec
Outils
Partager