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_data_parallel.sh 1.3 kB

12345678910111213141516171819202122232425262728293031323334353637
  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. # ============================================================================
  16. set -e
  17. BASE_PATH=$(cd "$(dirname $0)"; pwd)
  18. export DEVICE_NUM=2
  19. export RANK_SIZE=$DEVICE_NUM
  20. ulimit -n 65535
  21. export DISTRIBUTION_FILE=$BASE_PATH/tdt${DEVICE_NUM}p/tdt_
  22. export MINDSPORE_HCCL_CONFIG_PATH=$BASE_PATH/hccl_${DEVICE_NUM}p.json
  23. for((i=0;i<$DEVICE_NUM;i++))
  24. do
  25. rm -rf ./dataparallel$i
  26. mkdir ./dataparallel$i
  27. cp *.py ./dataparallel$i
  28. cp -r kernel_meta ./dataparallel$i
  29. cd ./dataparallel$i
  30. export RANK_ID=$i
  31. export DEVICE_ID=$i
  32. echo "start training for device $i"
  33. env > env$i.log
  34. python resnet_cifar.py --run_distribute=1 --device_num=$DEVICE_NUM --epoch_size=10 >log 2>&1 &
  35. cd ../
  36. done