#!/bin/bash function usage(){ echo "usage: paddle [--help] []" echo "These are common paddle commands used in various situations:" echo " train Start a paddle_trainer" echo " merge_model Start a paddle_merge_model" echo " pserver Start a paddle_pserver_main" echo " version Print paddle version" echo " dump_config Dump the trainer config as proto string" echo " make_diagram Make Diagram using Graphviz" echo "" echo "'paddle train --help' 'paddle merge_model --help', 'paddle pserver --help', list more detailed usage of each command" } function version(){ echo "PaddlePaddle @PADDLE_VERSION@, compiled with" echo " with_avx: @WITH_AVX@" echo " with_gpu: @WITH_GPU@" echo " with_double: @WITH_DOUBLE@" echo " with_python: @WITH_PYTHON@" echo " with_rdma: @WITH_RDMA@" echo " with_glog: @WITH_GLOG@" echo " with_gflags: @WITH_GFLAGS@" echo " with_metric_learning: @WITH_METRIC@" echo " with_timer: @WITH_TIMER@" echo " with_predict_sdk: @WITH_PREDICT_SDK@" } function ver2num() { set -e # convert version to number. if [ -z "$1" ]; then # empty argument printf "%03d%03d%03d%03d%03d" 0 else local VERN=$(echo $1 | sed 's#v##g' | sed 's#\.# #g' \ | sed 's#a# 0 #g' | sed 's#b# 1 #g' | sed 's#rc# 2 #g') if [ `echo $VERN | wc -w` -eq 3 ] ; then printf "%03d%03d%03d%03d%03d" $VERN 999 999 else printf "%03d%03d%03d%03d%03d" $VERN fi fi set +e } PADDLE_CONF_HOME="$HOME/.config/paddle" mkdir -p ${PADDLE_CONF_HOME} if [ -z "${PADDLE_NO_STAT+x}" ]; then SERVER_VER=`curl -m 5 -X POST --data content="{ \"version\": \"@PADDLE_VERSION@\" }"\ -b ${PADDLE_CONF_HOME}/paddle.cookie \ -c ${PADDLE_CONF_HOME}/paddle.cookie \ http://api.paddlepaddle.org/version 2>/dev/null` if [ $? -eq 0 ] && [ "$(ver2num @PADDLE_VERSION@)" -lt $(ver2num $SERVER_VER) ]; then echo "Paddle release a new version ${SERVER_VER}, you can get the install package in http://www.paddlepaddle.org" fi fi MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ ! -z "${DEBUGGER}" ]; then echo "Using debug command ${DEBUGGER}" fi CUDNN_LIB_PATH="@CUDNN_LIB_PATH@" if [ ! -z "${CUDNN_LIB_PATH}" ]; then export LD_LIBRARY_PATH=${CUDNN_LIB_PATH}:${LD_LIBRARY_PATH} fi export PYTHONPATH=${PWD}:${PYTHONPATH} # Check python lib installed or not. pip --help > /dev/null if [ $? -ne 0 ]; then echo "pip should be installed to run paddle." exit 1 fi INSTALLED_VERSION=`pip freeze 2>/dev/null | grep '^paddle' | sed 's/.*==//g'` if [ -z ${INSTALLED_VERSION} ]; then INSTALLED_VERSION="0.0.0" # not installed fi cat <