You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_onehot_model_parallel.sh 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. # ============================================================================
  16. set -e
  17. BASE_PATH=$(cd "$(dirname $0)"; pwd)
  18. CONFIG_PATH=/home/workspace/mindspore_config
  19. export DEVICE_NUM=8
  20. export RANK_SIZE=$DEVICE_NUM
  21. ulimit -n 65535
  22. source ${BASE_PATH}/env.sh
  23. unset SLOG_PRINT_TO_STDOUT
  24. export MINDSPORE_HCCL_CONFIG_PATH=$CONFIG_PATH/hccl/rank_table_${DEVICE_NUM}p.json
  25. process_pid=()
  26. for((i=0; i<$DEVICE_NUM; i++)); do
  27. rm -rf ${BASE_PATH}/onehot_model_parallel${i}
  28. mkdir ${BASE_PATH}/onehot_model_parallel${i}
  29. cp -r ${BASE_PATH}/onehot_model_parallel.py ${BASE_PATH}/onehot_model_parallel${i}/
  30. cd ${BASE_PATH}/onehot_model_parallel${i}
  31. export RANK_ID=${i}
  32. export DEVICE_ID=${i}
  33. echo "start training for device $i"
  34. env > env$i.log
  35. pytest -s -v onehot_model_parallel.py > onehot_model_parallel_log$i.log 2>&1 &
  36. process_pid[${i}]=`echo $!`
  37. done
  38. for((i=0; i<${DEVICE_NUM}; i++)); do
  39. wait ${process_pid[i]}
  40. status=`echo $?`
  41. if [ "${status}" != "0" ]; then
  42. echo "[ERROR] test_onehot_model_parallel failed. status: ${status}"
  43. exit 1
  44. else
  45. echo "[INFO] test_onehot_model_parallel success."
  46. fi
  47. done
  48. exit 0