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