Skip to content

Commit 393ac18

Browse files
authored
[CE] Add CE for Distributed Hybrid Parallel (#7782)
1 parent 37b4fe0 commit 393ac18

9 files changed

+316
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=CE_gpt-345m_seqlen1024_pretrain
16+
dp_degree=2
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-PP2-DP2-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=50000
24+
sharding=False
25+
sharding_degree=1
26+
virtual_pp_degree=1
27+
use_recompute=True
28+
eval_freq=25
29+
use_pipeline_parallel=True
30+
sequence_parallel=False
31+
32+
model=gpt
33+
micro_bs=8
34+
35+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
36+
# run
37+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
38+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-PP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=50000
24+
sharding=stage2
25+
sharding_degree=1
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=True
31+
sequence_parallel=False
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=CE_gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-SP2-PP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=50000
24+
sharding=stage1
25+
sharding_degree=2
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=True
31+
sequence_parallel=True
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=CE_gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=1
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-SP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=50000
24+
sharding=stage1
25+
sharding_degree=2
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=False
31+
sequence_parallel=True
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=gpt-345m_seqlen1024_pretrain
16+
dp_degree=2
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-PP2-DP2-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=100
24+
sharding=False
25+
sharding_degree=1
26+
virtual_pp_degree=1
27+
use_recompute=True
28+
eval_freq=25
29+
use_pipeline_parallel=True
30+
sequence_parallel=False
31+
32+
model=gpt
33+
micro_bs=8
34+
35+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
36+
# run
37+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
38+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-PP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=100
24+
sharding=stage1
25+
sharding_degree=2
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=True
31+
sequence_parallel=False
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=2
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-SP2-PP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=100
24+
sharding=stage1
25+
sharding_degree=2
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=True
31+
sequence_parallel=True
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
model_item=gpt-345m_seqlen1024_pretrain
16+
dp_degree=1
17+
mp_degree=2
18+
pp_degree=1
19+
bs_item=32
20+
fp_item=bf16
21+
run_mode=MP2-SP2-SD2-Stage1-mbs8-acc2
22+
device_num=N1C8
23+
max_iter=100
24+
sharding=stage1
25+
sharding_degree=2
26+
27+
virtual_pp_degree=1
28+
use_recompute=True
29+
eval_freq=25
30+
use_pipeline_parallel=False
31+
sequence_parallel=True
32+
33+
model=gpt
34+
micro_bs=8
35+
36+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
37+
# run
38+
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
39+
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} 2>&1;

tests/test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,16 @@ function _train(){
150150
run_pretrain.py ${train_cmd}"
151151
workerlog_id=0
152152
;;
153-
DP8-mbs2-acc2|SD8-stage1-mbs2-acc2|SD8-stage2-mbs2-acc2|SD8-stage3-mbs2-acc2|MP2-SD4-stage1-mbs4-acc2|MP2-SP2-PP2-DP2-mbs8-acc2|MP8-mbs16-acc2) echo "run run_mode: ${run_mode}"
153+
DP8-mbs2-acc2|SD8-stage1-mbs2-acc2|SD8-stage2-mbs2-acc2|SD8-stage3-mbs2-acc2|MP2-SD4-stage1-mbs4-acc2|MP2-SP2-PP2-DP2-mbs8-acc2|MP8-mbs16-acc2|MP2-PP2-DP2-mbs8-acc2|MP2-PP2-SD2-Stage1-mbs8-acc2|MP2-SP2-PP2-SD2-Stage1-mbs8-acc2) echo "run run_mode: ${run_mode}"
154154
train_cmd="python -m paddle.distributed.launch --log_dir=./mylog --devices=0,1,2,3,4,5,6,7 ${PADDLE_RANK_OPTION}\
155155
run_pretrain.py ${train_cmd}"
156156
workerlog_id=0
157157
;;
158+
MP2-SP2-SD2-Stage1-mbs8-acc2) echo "run run_mode: ${run_mode}"
159+
train_cmd="python -m paddle.distributed.launch --log_dir=./mylog --devices=0,1,2,3 ${PADDLE_RANK_OPTION}\
160+
run_pretrain.py ${train_cmd}"
161+
workerlog_id=0
162+
;;
158163
*) echo "choose run_mode "; exit 1;
159164
esac
160165
cd ../llm/gpt-3

0 commit comments

Comments
 (0)