1#!/bin/bash 2# Copyright 2020 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) 18CONFIG_PATH=/home/workspace/mindspore_config 19export DEVICE_NUM=8 20export RANK_SIZE=$DEVICE_NUM 21source ${BASE_PATH}/env.sh 22unset SLOG_PRINT_TO_STDOUT 23export MINDSPORE_HCCL_CONFIG_PATH=$CONFIG_PATH/hccl/rank_table_${DEVICE_NUM}p.json 24export LD_LIBRARY_PATH=/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH} 25export ASCEND_OPP_PATH=/usr/local/Ascend/opp/ 26 27process_pid=() 28for((i=0; i<$DEVICE_NUM; i++)); do 29 rm -rf ${BASE_PATH}/parallel_strategy_search${i} 30 mkdir ${BASE_PATH}/parallel_strategy_search${i} 31 cp -r ${BASE_PATH}/parallel_strategy_search.py ${BASE_PATH}/parallel_strategy_search${i}/ 32 cd ${BASE_PATH}/parallel_strategy_search${i} 33 export RANK_ID=${i} 34 export DEVICE_ID=${i} 35 echo "start training for device $i" 36 env > env$i.log 37 pytest -s -v parallel_strategy_search.py::test_auto_parallel_strategy_search_axis_1_basic > parallel_strategy_search$i.log 2>&1 & 38 process_pid[${i}]=`echo $!` 39done 40 41for((i=0; i<${DEVICE_NUM}; i++)); do 42 wait ${process_pid[i]} 43 status=`echo $?` 44 if [ "${status}" != "0" ]; then 45 echo "[ERROR] test_parallel_strategy_search failed. status: ${status}" 46 exit 1 47 else 48 echo "[INFO] test_parallel_strategy_search success." 49 fi 50done 51 52exit 0 53