1#!/bin/bash 2# Copyright 2019 Huawei Technologies Co., Ltd 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================ 16set -e 17BASE_PATH=$(cd "$(dirname $0)"; pwd) 18export DEVICE_NUM=2 19export RANK_SIZE=$DEVICE_NUM 20ulimit -n 65535 21export DISTRIBUTION_FILE=$BASE_PATH/tdt${DEVICE_NUM}p/tdt_ 22export MINDSPORE_HCCL_CONFIG_PATH=$BASE_PATH/hccl_${DEVICE_NUM}p.json 23 24for((i=0;i<$DEVICE_NUM;i++)) 25do 26 rm -rf ./dataparallel$i 27 mkdir ./dataparallel$i 28 cp *.py ./dataparallel$i 29 cp -r kernel_meta ./dataparallel$i 30 cd ./dataparallel$i 31 export RANK_ID=$i 32 export DEVICE_ID=$i 33 echo "start training for device $i" 34 env > env$i.log 35 python resnet_cifar.py --run_distribute=1 --device_num=$DEVICE_NUM --epoch_size=10 >log 2>&1 & 36 cd ../ 37done