!6245 modify the way of read device num

Merge pull request !6245 from hwjiaorui/master
This commit is contained in:
mindspore-ci-bot 2020-09-15 16:27:04 +08:00 committed by Gitee
commit 73d4ceeaf7
1 changed files with 4 additions and 3 deletions

View File

@ -91,11 +91,12 @@ run_ascend(){
#device_num=${#device_id_list}
cat $2 | awk -F "[device_id]" '/device_id/{print$0}' >temp.log
array=$(cat temp.log | awk -F "[:]" '/device_id/{print$2}')
rm temp.log
IFS=" " read -ra device_list <<<$array
first_device=${device_list[0]:1:1}
device_num=${#device_list[*]}
#device_num=${#device_list[*]}
device_num=$(cat temp.log | wc -l)
rm temp.log
ulimit -u unlimited
export DEVICE_NUM=${device_num}
export RANK_SIZE=${device_num}