Skip to content
Snippets Groups Projects
Unverified Commit a5c6177f authored by i-robot's avatar i-robot Committed by Gitee
Browse files

!2660 add alexnet gpu run scripts

Merge pull request !2660 from xubangduo/add-alexnet-scripts
parents de253d92 a6d24e64
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
# an simple tutorial as follows, more parameters can be setting
if [ $# != 3 ]
then
echo "Usage: sh run_distribution_gpu.sh [cifar10|imagenet] [DATA_PATH] [CKPT_PATH]"
exit 1
fi
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
if [ $# -ge 1 ]; then
if [ $1 == 'imagenet' ]; then
CONFIG_FILE="${BASE_PATH}/../config_imagenet.yaml"
elif [ $1 == 'cifar10' ]; then
CONFIG_FILE="${BASE_PATH}/../cifar10_distribute.yaml"
else
echo "Unrecognized parameter"
exit 1
fi
else
CONFIG_FILE="${BASE_PATH}/../default_config.yaml"
fi
ulimit -u unlimited
export DEVICE_NUM=8
export RANK_SIZE=8
export DATASET_NAME=$1
export DATA_PATH=$2
export CKPT_PATH=$3
rm -rf ./train_parallel
mkdir ./train_parallel
cp -r ../src ./train_parallel
cp ../train.py ./train_parallel
echo "start training"
cd ./train_parallel ||exit
env > env.log
mpirun -n 8 --allow-run-as-root --output-filename log_output --merge-stderr-to-stdout \
python train.py --config_path=$CONFIG_FILE --dataset_name=$DATASET_NAME \
--data_path=$DATA_PATH --ckpt_path=$CKPT_PATH --device_target="GPU" > log 2>&1 &
cd ..
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment