From 763e8fdf02ebe00b845680b264b7a5c6a56b61ae Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 17 Dec 2018 11:17:10 +0800 Subject: [PATCH] fix compile error --- paddle/fluid/platform/for_range.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/platform/for_range.h b/paddle/fluid/platform/for_range.h index 9fbaa36723..a767bf9299 100644 --- a/paddle/fluid/platform/for_range.h +++ b/paddle/fluid/platform/for_range.h @@ -117,17 +117,18 @@ __global__ static void ForRangeInElemwiseOp(Function func, T* vector, template <> struct ForRangeIn { - ForRange(const CUDADeviceContext& dev_ctx, std::vector range) + ForRangeIn(const CUDADeviceContext& dev_ctx, std::vector range) : dev_ctx_(dev_ctx), range_(range) {} template inline void operator()(Function func) const { constexpr int num_threads = 1024; - int block_size = range_.size() <= num_threads ? limit_ : num_threads; + int range_size = range_.size(); + int block_size = range_size <= num_threads ? range_size : num_threads; int grid_size = (range_.size() + num_threads - 1) / num_threads; ForRangeInElemwiseOp<<>>( - func, range_.data(), range_.size()); + func, range_.data(), range_size); } const CUDADeviceContext& dev_ctx_; -- GitLab