You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2018/04/30 17:06:17 UTC
[incubator-mxnet] 06/10: fix race condition in csr cast_storage
block kernel (#10643)
This is an automated email from the ASF dual-hosted git repository.
jxie pushed a commit to branch v1.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit a0c30317087cf75319760cb9bdc54be5f57ef9fe
Author: Haibin Lin <li...@gmail.com>
AuthorDate: Mon Apr 23 19:33:49 2018 -0700
fix race condition in csr cast_storage block kernel (#10643)
---
src/operator/tensor/cast_storage-inl.cuh | 2 ++
tests/python/unittest/test_sparse_operator.py | 3 +++
2 files changed, 5 insertions(+)
diff --git a/src/operator/tensor/cast_storage-inl.cuh b/src/operator/tensor/cast_storage-inl.cuh
index c441341..a5b4df5 100644
--- a/src/operator/tensor/cast_storage-inl.cuh
+++ b/src/operator/tensor/cast_storage-inl.cuh
@@ -436,6 +436,8 @@ struct CastDnsCsrColIdxAndValsBlockKernel {
nnz++;
}
}
+ // make sure k was updated using block_nnz in the previous iter
+ __syncthreads();
if (threadIdx.x == kBaseThreadNum-1) {
block_nnz = nnz;
}
diff --git a/tests/python/unittest/test_sparse_operator.py b/tests/python/unittest/test_sparse_operator.py
index dd0c5a6..2c9bedd 100644
--- a/tests/python/unittest/test_sparse_operator.py
+++ b/tests/python/unittest/test_sparse_operator.py
@@ -1198,6 +1198,9 @@ def test_cast_storage_ex():
# test gpu block kernel
check_cast_storage((dim0, rnd.randint(512, 1024)), d, 'default', 'csr',
check_numeric_grad=False)
+ # check race condition in block kernel
+ check_cast_storage((200, 128 * 2 + 1), d, 'default', 'csr',
+ check_numeric_grad=False)
# test gpu thread kernel
check_cast_storage((dim0, rnd.randint( 1, 32)), d, 'default', 'row_sparse')
# test gpu warp kernel
--
To stop receiving notification emails like this one, please contact
jxie@apache.org.