-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Change size_t to int within for loop to fix windows build error #14740
Conversation
wkcn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the fix!
|
Are these the only changes needed to fix the windows build error? I thought there are more for loops with size_t as index in the code. |
| size_t bias_size = bias.shape().Size(); | ||
| #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) | ||
| for (size_t i = 0; i < bias_size; ++i) { | ||
| for (int i = 0; i < static_cast<int>(bias_size); ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the static_cat from size_t to int safety if the value of bias_size is large than the range of int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already changed to index_t.
|
@apeforest That are the only two cases we found in local. There were other places reported in #14203 . I think some of them have already been fixed via other PRs. |
|
Thank you for the fix. @yinghu5 You may be interested. |
apeforest
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thank you for the contribution @ciyongch. It's now merged. |
…he#14740) * change size_t to int for supporting OpenMp 2.0 windows build * change int to index_t
Description
This patch is to fix the build error of using "size_t" within for loop on Windows Platform, since MSVC only support OpenMP 2.0 standard, which will cause the "error C3016: 'i' : index variable in OpenMP 'for' statement must have signed integral type".
@pengzhao-intel @TaoLv
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments