未验证 提交 2006b817 编写于 作者: T Thunderbrook 提交者: GitHub

fix device_free (#42462)

上级 70120c7f
...@@ -584,7 +584,7 @@ void HeterComm<KeyType, ValType, GradType>::pull_sparse(int num, ...@@ -584,7 +584,7 @@ void HeterComm<KeyType, ValType, GradType>::pull_sparse(int num,
for (int i = 0; i < total_device; ++i) { for (int i = 0; i < total_device; ++i) {
int shard_len = h_right[i] - h_left[i] + 1; int shard_len = h_right[i] - h_left[i] + 1;
if (shard_len == 0) { if (h_left[i] == -1 || h_right[i] == -1) {
continue; continue;
} }
create_storage(num, i, shard_len * sizeof(KeyType), create_storage(num, i, shard_len * sizeof(KeyType),
...@@ -630,6 +630,9 @@ void HeterComm<KeyType, ValType, GradType>::pull_sparse(int num, ...@@ -630,6 +630,9 @@ void HeterComm<KeyType, ValType, GradType>::pull_sparse(int num,
sync_stream(stream); sync_stream(stream);
for (int i = 0; i < total_device; ++i) { for (int i = 0; i < total_device; ++i) {
if (h_left[i] == -1 || h_right[i] == -1) {
continue;
}
destroy_storage(num, i); destroy_storage(num, i);
} }
} }
...@@ -747,6 +750,9 @@ void HeterComm<KeyType, ValType, GradType>::push_sparse(int dev_num, ...@@ -747,6 +750,9 @@ void HeterComm<KeyType, ValType, GradType>::push_sparse(int dev_num,
} }
for (int i = 0; i < total_device; ++i) { for (int i = 0; i < total_device; ++i) {
if (h_left[i] == -1 || h_right[i] == -1) {
continue;
}
destroy_storage(dev_num, i); destroy_storage(dev_num, i);
} }
} }
...@@ -862,6 +868,9 @@ void HeterComm<KeyType, ValType, GradType>::push_sparse(int dev_num, ...@@ -862,6 +868,9 @@ void HeterComm<KeyType, ValType, GradType>::push_sparse(int dev_num,
} }
for (int i = 0; i < total_device; ++i) { for (int i = 0; i < total_device; ++i) {
if (h_left[i] == -1 || h_right[i] == -1) {
continue;
}
destroy_storage(dev_num, i); destroy_storage(dev_num, i);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册