Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GPT N4C32 benchmark script bug #3392

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions tests/test_tipc/benchmark_train.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash

# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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.

source test_tipc/common_func.sh

# run benchmark sh
Expand Down Expand Up @@ -67,6 +82,12 @@ function set_gpu_id(){
echo $seq
}

function get_world_size(){
IFS="C"
arr=($1)
echo ${arr[1]}
}

function get_repo_name(){
IFS=";"
cur_dir=$(pwd)
Expand Down Expand Up @@ -202,10 +223,10 @@ for batch_size in ${batch_size_list[*]}; do

# NOTE: Only for GPT for now.
if [[ ${model_name} =~ gpt* ]]; then
num_gpu_devices=$[(${#gpu_id}+1)/2]
num_gpu_devices=`get_world_size $device_num`
sed_norm_train=$norm_train

global_batch_size=$[$batch_size*$num_gpu_devices]
global_batch_size=$(($batch_size*$num_gpu_devices))
extra_params="--global_batch_size=$global_batch_size --dp_degree=$num_gpu_devices"
sed_norm_train="$sed_norm_train $extra_params"

Expand Down