|
|
|
@@ -273,13 +273,9 @@ class DatasetLenet(): |
|
|
|
return 1 |
|
|
|
|
|
|
|
|
|
|
|
def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 #131072 #32768 #8192 |
|
|
|
def train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): |
|
|
|
dev_num = 8 |
|
|
|
context.set_auto_parallel_context(parallel_mode=ParallelMode.AUTO_PARALLEL, device_num=dev_num) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_gamma=0.001, costmodel_beta=260.0) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_algorithm=1) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_times=2) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_tail_percent=0.5) |
|
|
|
set_algo_parameters(elementwise_op_strategy_follow=True) |
|
|
|
resset_op_id() |
|
|
|
np.random.seed(6) |
|
|
|
@@ -303,8 +299,16 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
assert v == [[dev_num, 1]] |
|
|
|
|
|
|
|
allreduce_fusion_dict = _executor._get_allreduce_fusion(model._train_network) |
|
|
|
|
|
|
|
print(allreduce_fusion_dict) |
|
|
|
return allreduce_fusion_dict |
|
|
|
|
|
|
|
|
|
|
|
def test_train_32k_8p_fusion1(epoch_size=3, batch_size=32, num_classes=32768): #1048576 #131072 #32768 #8192 |
|
|
|
cost_model_context.set_cost_model_context(costmodel_gamma=0.001, costmodel_beta=260.0) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_algorithm=1) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_times=2) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_tail_percent=0.5) |
|
|
|
allreduce_fusion_dict = train_32k_8p(epoch_size, batch_size, num_classes) |
|
|
|
expect_dict = {'end_point.bias': 2, |
|
|
|
'end_point.weight': 2, |
|
|
|
'layer4.2.bn3.beta': 2, |
|
|
|
@@ -382,11 +386,11 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer3.1.bn1.beta': 2, |
|
|
|
'layer3.1.bn1.gamma': 2, |
|
|
|
'layer3.1.conv1.weight': 2, |
|
|
|
'layer3.0.bn_down_sample.beta': 1, |
|
|
|
'layer3.0.bn_down_sample.gamma': 1, |
|
|
|
'layer3.0.bn_down_sample.beta': 2, |
|
|
|
'layer3.0.bn_down_sample.gamma': 2, |
|
|
|
'layer3.0.conv_down_sample.weight': 2, |
|
|
|
'layer3.0.bn3.beta': 1, |
|
|
|
'layer3.0.bn3.gamma': 1, |
|
|
|
'layer3.0.bn3.beta': 2, |
|
|
|
'layer3.0.bn3.gamma': 2, |
|
|
|
'layer3.0.conv3.weight': 2, |
|
|
|
'layer3.0.bn2.beta': 2, |
|
|
|
'layer3.0.bn2.gamma': 2, |
|
|
|
@@ -412,8 +416,8 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer2.2.bn1.beta': 2, |
|
|
|
'layer2.2.bn1.gamma': 2, |
|
|
|
'layer2.2.conv1.weight': 2, |
|
|
|
'layer2.1.bn3.beta': 1, |
|
|
|
'layer2.1.bn3.gamma': 1, |
|
|
|
'layer2.1.bn3.beta': 2, |
|
|
|
'layer2.1.bn3.gamma': 2, |
|
|
|
'layer2.1.conv3.weight': 2, |
|
|
|
'layer2.1.bn2.beta': 2, |
|
|
|
'layer2.1.bn2.gamma': 2, |
|
|
|
@@ -421,11 +425,11 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer2.1.bn1.beta': 2, |
|
|
|
'layer2.1.bn1.gamma': 2, |
|
|
|
'layer2.1.conv1.weight': 2, |
|
|
|
'layer2.0.bn_down_sample.beta': 1, |
|
|
|
'layer2.0.bn_down_sample.gamma': 1, |
|
|
|
'layer2.0.bn_down_sample.beta': 2, |
|
|
|
'layer2.0.bn_down_sample.gamma': 2, |
|
|
|
'layer2.0.conv_down_sample.weight': 2, |
|
|
|
'layer2.0.bn3.beta': 1, |
|
|
|
'layer2.0.bn3.gamma': 1, |
|
|
|
'layer2.0.bn3.beta': 2, |
|
|
|
'layer2.0.bn3.gamma': 2, |
|
|
|
'layer2.0.conv3.weight': 2, |
|
|
|
'layer2.0.bn2.beta': 2, |
|
|
|
'layer2.0.bn2.gamma': 2, |
|
|
|
@@ -442,8 +446,8 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer1.2.bn1.beta': 2, |
|
|
|
'layer1.2.bn1.gamma': 2, |
|
|
|
'layer1.2.conv1.weight': 2, |
|
|
|
'layer1.1.bn3.beta': 1, |
|
|
|
'layer1.1.bn3.gamma': 1, |
|
|
|
'layer1.1.bn3.beta': 2, |
|
|
|
'layer1.1.bn3.gamma': 2, |
|
|
|
'layer1.1.conv3.weight': 2, |
|
|
|
'layer1.1.bn2.beta': 2, |
|
|
|
'layer1.1.bn2.gamma': 2, |
|
|
|
@@ -451,11 +455,11 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer1.1.bn1.beta': 2, |
|
|
|
'layer1.1.bn1.gamma': 2, |
|
|
|
'layer1.1.conv1.weight': 2, |
|
|
|
'layer1.0.bn_down_sample.beta': 1, |
|
|
|
'layer1.0.bn_down_sample.gamma': 1, |
|
|
|
'layer1.0.bn_down_sample.beta': 2, |
|
|
|
'layer1.0.bn_down_sample.gamma': 2, |
|
|
|
'layer1.0.conv_down_sample.weight': 2, |
|
|
|
'layer1.0.bn3.beta': 1, |
|
|
|
'layer1.0.bn3.gamma': 1, |
|
|
|
'layer1.0.bn3.beta': 2, |
|
|
|
'layer1.0.bn3.gamma': 2, |
|
|
|
'layer1.0.conv3.weight': 2, |
|
|
|
'layer1.0.bn2.beta': 2, |
|
|
|
'layer1.0.bn2.gamma': 2, |
|
|
|
@@ -465,7 +469,180 @@ def test_train_32k_8p(epoch_size=3, batch_size=32, num_classes=32768): #1048576 |
|
|
|
'layer1.0.conv1.weight': 2, |
|
|
|
'bn1.beta': 1, |
|
|
|
'bn1.gamma': 1, |
|
|
|
'conv1.weight': 2} |
|
|
|
'conv1.weight': 1} |
|
|
|
|
|
|
|
assert (allreduce_fusion_dict == expect_dict) |
|
|
|
cost_model_context.reset_cost_model_context() |
|
|
|
|
|
|
|
|
|
|
|
def test_train_32k_8p_fusion2(epoch_size=3, batch_size=32, num_classes=32768): #1048576 #131072 #32768 #8192 |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_algorithm=2) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_tail_time=0.1) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_allreduce_inherent_time=0.05) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_allreduce_bandwidth=0.000001) |
|
|
|
cost_model_context.set_cost_model_context(costmodel_allreduce_fusion_computation_time_parameter=0.0000015) |
|
|
|
allreduce_fusion_dict = train_32k_8p(epoch_size, batch_size, num_classes) |
|
|
|
expect_dict = {'end_point.bias': 2, |
|
|
|
'end_point.weight': 2, |
|
|
|
'layer4.2.bn3.beta': 2, |
|
|
|
'layer4.2.bn3.gamma': 2, |
|
|
|
'layer4.2.conv3.weight': 2, |
|
|
|
'layer4.2.bn2.beta': 2, |
|
|
|
'layer4.2.bn2.gamma': 2, |
|
|
|
'layer4.2.conv2.weight': 2, |
|
|
|
'layer4.2.bn1.beta': 2, |
|
|
|
'layer4.2.bn1.gamma': 2, |
|
|
|
'layer4.2.conv1.weight': 2, |
|
|
|
'layer4.1.bn3.beta': 2, |
|
|
|
'layer4.1.bn3.gamma': 2, |
|
|
|
'layer4.1.conv3.weight': 2, |
|
|
|
'layer4.1.bn2.beta': 2, |
|
|
|
'layer4.1.bn2.gamma': 2, |
|
|
|
'layer4.1.conv2.weight': 2, |
|
|
|
'layer4.1.bn1.beta': 2, |
|
|
|
'layer4.1.bn1.gamma': 2, |
|
|
|
'layer4.1.conv1.weight': 2, |
|
|
|
'layer4.0.bn_down_sample.beta': 2, |
|
|
|
'layer4.0.bn_down_sample.gamma': 2, |
|
|
|
'layer4.0.conv_down_sample.weight': 2, |
|
|
|
'layer4.0.bn3.beta': 2, |
|
|
|
'layer4.0.bn3.gamma': 2, |
|
|
|
'layer4.0.conv3.weight': 2, |
|
|
|
'layer4.0.bn2.beta': 2, |
|
|
|
'layer4.0.bn2.gamma': 2, |
|
|
|
'layer4.0.conv2.weight': 2, |
|
|
|
'layer4.0.bn1.beta': 2, |
|
|
|
'layer4.0.bn1.gamma': 2, |
|
|
|
'layer4.0.conv1.weight': 2, |
|
|
|
'layer3.5.bn3.beta': 2, |
|
|
|
'layer3.5.bn3.gamma': 2, |
|
|
|
'layer3.5.conv3.weight': 2, |
|
|
|
'layer3.5.bn2.beta': 2, |
|
|
|
'layer3.5.bn2.gamma': 2, |
|
|
|
'layer3.5.conv2.weight': 2, |
|
|
|
'layer3.5.bn1.beta': 2, |
|
|
|
'layer3.5.bn1.gamma': 2, |
|
|
|
'layer3.5.conv1.weight': 2, |
|
|
|
'layer3.4.bn3.beta': 2, |
|
|
|
'layer3.4.bn3.gamma': 2, |
|
|
|
'layer3.4.conv3.weight': 2, |
|
|
|
'layer3.4.bn2.beta': 2, |
|
|
|
'layer3.4.bn2.gamma': 2, |
|
|
|
'layer3.4.conv2.weight': 2, |
|
|
|
'layer3.4.bn1.beta': 2, |
|
|
|
'layer3.4.bn1.gamma': 2, |
|
|
|
'layer3.4.conv1.weight': 2, |
|
|
|
'layer3.3.bn3.beta': 2, |
|
|
|
'layer3.3.bn3.gamma': 2, |
|
|
|
'layer3.3.conv3.weight': 2, |
|
|
|
'layer3.3.bn2.beta': 2, |
|
|
|
'layer3.3.bn2.gamma': 2, |
|
|
|
'layer3.3.conv2.weight': 2, |
|
|
|
'layer3.3.bn1.beta': 2, |
|
|
|
'layer3.3.bn1.gamma': 2, |
|
|
|
'layer3.3.conv1.weight': 2, |
|
|
|
'layer3.2.bn3.beta': 2, |
|
|
|
'layer3.2.bn3.gamma': 2, |
|
|
|
'layer3.2.conv3.weight': 2, |
|
|
|
'layer3.2.bn2.beta': 2, |
|
|
|
'layer3.2.bn2.gamma': 2, |
|
|
|
'layer3.2.conv2.weight': 2, |
|
|
|
'layer3.2.bn1.beta': 2, |
|
|
|
'layer3.2.bn1.gamma': 2, |
|
|
|
'layer3.2.conv1.weight': 2, |
|
|
|
'layer3.1.bn3.beta': 2, |
|
|
|
'layer3.1.bn3.gamma': 2, |
|
|
|
'layer3.1.conv3.weight': 2, |
|
|
|
'layer3.1.bn2.beta': 2, |
|
|
|
'layer3.1.bn2.gamma': 2, |
|
|
|
'layer3.1.conv2.weight': 2, |
|
|
|
'layer3.1.bn1.beta': 2, |
|
|
|
'layer3.1.bn1.gamma': 2, |
|
|
|
'layer3.1.conv1.weight': 2, |
|
|
|
'layer3.0.bn_down_sample.beta': 2, |
|
|
|
'layer3.0.bn_down_sample.gamma': 2, |
|
|
|
'layer3.0.conv_down_sample.weight': 2, |
|
|
|
'layer3.0.bn3.beta': 2, |
|
|
|
'layer3.0.bn3.gamma': 2, |
|
|
|
'layer3.0.conv3.weight': 2, |
|
|
|
'layer3.0.bn2.beta': 2, |
|
|
|
'layer3.0.bn2.gamma': 2, |
|
|
|
'layer3.0.conv2.weight': 2, |
|
|
|
'layer3.0.bn1.beta': 2, |
|
|
|
'layer3.0.bn1.gamma': 2, |
|
|
|
'layer3.0.conv1.weight': 2, |
|
|
|
'layer2.3.bn3.beta': 2, |
|
|
|
'layer2.3.bn3.gamma': 2, |
|
|
|
'layer2.3.conv3.weight': 2, |
|
|
|
'layer2.3.bn2.beta': 2, |
|
|
|
'layer2.3.bn2.gamma': 2, |
|
|
|
'layer2.3.conv2.weight': 2, |
|
|
|
'layer2.3.bn1.beta': 2, |
|
|
|
'layer2.3.bn1.gamma': 2, |
|
|
|
'layer2.3.conv1.weight': 2, |
|
|
|
'layer2.2.bn3.beta': 2, |
|
|
|
'layer2.2.bn3.gamma': 2, |
|
|
|
'layer2.2.conv3.weight': 2, |
|
|
|
'layer2.2.bn2.beta': 2, |
|
|
|
'layer2.2.bn2.gamma': 2, |
|
|
|
'layer2.2.conv2.weight': 2, |
|
|
|
'layer2.2.bn1.beta': 2, |
|
|
|
'layer2.2.bn1.gamma': 2, |
|
|
|
'layer2.2.conv1.weight': 2, |
|
|
|
'layer2.1.bn3.beta': 2, |
|
|
|
'layer2.1.bn3.gamma': 2, |
|
|
|
'layer2.1.conv3.weight': 2, |
|
|
|
'layer2.1.bn2.beta': 2, |
|
|
|
'layer2.1.bn2.gamma': 2, |
|
|
|
'layer2.1.conv2.weight': 2, |
|
|
|
'layer2.1.bn1.beta': 2, |
|
|
|
'layer2.1.bn1.gamma': 2, |
|
|
|
'layer2.1.conv1.weight': 2, |
|
|
|
'layer2.0.bn_down_sample.beta': 2, |
|
|
|
'layer2.0.bn_down_sample.gamma': 2, |
|
|
|
'layer2.0.conv_down_sample.weight': 2, |
|
|
|
'layer2.0.bn3.beta': 2, |
|
|
|
'layer2.0.bn3.gamma': 2, |
|
|
|
'layer2.0.conv3.weight': 2, |
|
|
|
'layer2.0.bn2.beta': 2, |
|
|
|
'layer2.0.bn2.gamma': 2, |
|
|
|
'layer2.0.conv2.weight': 2, |
|
|
|
'layer2.0.bn1.beta': 2, |
|
|
|
'layer2.0.bn1.gamma': 2, |
|
|
|
'layer2.0.conv1.weight': 2, |
|
|
|
'layer1.2.bn3.beta': 2, |
|
|
|
'layer1.2.bn3.gamma': 2, |
|
|
|
'layer1.2.conv3.weight': 2, |
|
|
|
'layer1.2.bn2.beta': 2, |
|
|
|
'layer1.2.bn2.gamma': 2, |
|
|
|
'layer1.2.conv2.weight': 2, |
|
|
|
'layer1.2.bn1.beta': 2, |
|
|
|
'layer1.2.bn1.gamma': 2, |
|
|
|
'layer1.2.conv1.weight': 2, |
|
|
|
'layer1.1.bn3.beta': 2, |
|
|
|
'layer1.1.bn3.gamma': 2, |
|
|
|
'layer1.1.conv3.weight': 2, |
|
|
|
'layer1.1.bn2.beta': 2, |
|
|
|
'layer1.1.bn2.gamma': 2, |
|
|
|
'layer1.1.conv2.weight': 2, |
|
|
|
'layer1.1.bn1.beta': 2, |
|
|
|
'layer1.1.bn1.gamma': 2, |
|
|
|
'layer1.1.conv1.weight': 2, |
|
|
|
'layer1.0.bn_down_sample.beta': 2, |
|
|
|
'layer1.0.bn_down_sample.gamma': 2, |
|
|
|
'layer1.0.conv_down_sample.weight': 2, |
|
|
|
'layer1.0.bn3.beta': 2, |
|
|
|
'layer1.0.bn3.gamma': 2, |
|
|
|
'layer1.0.conv3.weight': 2, |
|
|
|
'layer1.0.bn2.beta': 2, |
|
|
|
'layer1.0.bn2.gamma': 2, |
|
|
|
'layer1.0.conv2.weight': 1, |
|
|
|
'layer1.0.bn1.beta': 1, |
|
|
|
'layer1.0.bn1.gamma': 1, |
|
|
|
'layer1.0.conv1.weight': 1, |
|
|
|
'bn1.beta': 1, |
|
|
|
'bn1.gamma': 1, |
|
|
|
'conv1.weight': 1} |
|
|
|
|
|
|
|
assert (allreduce_fusion_dict == expect_dict) |
|
|
|
cost_model_context.reset_cost_model_context() |
|
|
|
|