env.sh 929 字节
Newer Older
Z
zhanghan17 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/usr/bin/env bash

set -xu

function check_iplist() {
    if  [[ ${iplist:-""} == "" ]] ;then
        iplist=`hostname -i`
    fi

    export PADDLE_PSERVER_PORT=9184
    export PADDLE_TRAINER_IPS=${iplist} 
    export PADDLE_CURRENT_IP=`hostname -i`
        
    iparray=(${iplist//,/ })
    for i in "${!iparray[@]}"; do
        if [ ${iparray[$i]} == ${PADDLE_CURRENT_IP} ]; then
            export PADDLE_TRAINER_ID=$i
        fi
    done
        
    export TRAINING_ROLE=TRAINER
    export PADDLE_INIT_TRAINER_COUNT=${#iparray[@]}
    export PADDLE_PORT=${PADDLE_PSERVER_PORT}
    export PADDLE_TRAINERS=${PADDLE_TRAINER_IPS}
    export POD_IP=${PADDLE_CURRENT_IP}
    export PADDLE_TRAINERS_NUM=${PADDLE_INIT_TRAINER_COUNT}
    export PADDLE_IS_LOCAL=0
  
    #paddle debug envs
    export GLOG_v=0
    export GLOG_logtostderr=1
        
    #nccl debug envs
    export NCCL_DEBUG=INFO
    export NCCL_IB_GID_INDEX=3
}