lupesko commented on a change in pull request #11780: fix flaky test
test_operator_gpu.test_countsketch
URL: https://github.com/apache/incubator-mxnet/pull/11780#discussion_r203629802
##########
File path: src/operator/contrib/count_sketch.cu
##########
@@ -165,7 +165,8 @@ inline void CountSketchBackward(const Tensor<gpu, 2,
DType> &in_grad,
nthreads, in_grad_ptr+bstart*in_dim, h_ptr,
s_ptr, out_grad_ptr+bstart*out_dim, batchlen,
in_dim, out_dim);
- MSHADOW_CUDA_POST_KERNEL_CHECK(sketch_backward_kernel);
+ cudaError_t err = cudaDeviceSynchronize();
Review comment:
DRY is not only about lines of code, it is more about maintaimability.
Consider a case where there is an issue with the flow in line 168, and the
developer decides to change it from cudaDeviceSynchronize to another API.
Without DRY, the developer will need to remember to look for other places in
the code that call the API. Sometimes, this will be missed. With DRY, different
parts of the code are funneled to the one function or whatever that has this
logic, and by updating in one location all code paths are updated. Makes sense?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services