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.

shell_run_test.sh 2.1 kB

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. execute_path=$(pwd)
  17. self_path=$(dirname $0)
  18. export MS_SCHED_NUM=1
  19. DEVICE_TARGET=$1
  20. DATASET_PATH=$2
  21. export MS_WORKER_NUM=$3
  22. export MS_SERVER_NUM=$4
  23. export MS_SCHED_HOST=$5
  24. export MS_SCHED_PORT=$6
  25. export MS_ROLE=MS_SCHED
  26. for((i=0;i<1;i++));
  27. do
  28. rm -rf ${execute_path}/sched_$i/
  29. mkdir ${execute_path}/sched_$i/
  30. cd ${execute_path}/sched_$i/ || exit
  31. python ${self_path}/../test_full_ps_lenet.py --device_target=$DEVICE_TARGET --dataset_path=$DATASET_PATH &
  32. done
  33. export MS_ROLE=MS_PSERVER
  34. for((i=0;i<$MS_SERVER_NUM;i++));
  35. do
  36. rm -rf ${execute_path}/server_$i/
  37. mkdir ${execute_path}/server_$i/
  38. cd ${execute_path}/server_$i/ || exit
  39. python ${self_path}/../test_full_ps_lenet.py --device_target=$DEVICE_TARGET --dataset_path=$DATASET_PATH &
  40. done
  41. export MS_ROLE=MS_WORKER
  42. process_pid=()
  43. for((i=0;i<$MS_WORKER_NUM;i++));
  44. do
  45. rm -rf ${execute_path}/worker_$i/
  46. mkdir ${execute_path}/worker_$i/
  47. cd ${execute_path}/worker_$i/ || exit
  48. python ${self_path}/../test_full_ps_lenet.py --device_target=$DEVICE_TARGET --dataset_path=$DATASET_PATH &
  49. process_pid[${i}]=`echo $!`
  50. done
  51. for((i=0; i<${MS_WORKER_NUM}; i++)); do
  52. wait ${process_pid[i]}
  53. status=`echo $?`
  54. if [ "${status}" != "0" ]; then
  55. echo "[ERROR] test_full_ps_lenet failed. status: ${status}"
  56. exit 1
  57. else
  58. echo "[INFO] test_full_ps_lenet success."
  59. fi
  60. done
  61. exit 0