Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
此处对常数加类型控制,会不会更好?
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.
@backyes 但是这里tid变量 在不同操作系统类型不一样。
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.
@gangliao 如果这个问题很严重,建议还是加一层抽象,否则换个平台你这种强制int 可能还会有问题。
如果这个BUG比较紧急,可以考虑先ci解决临时问题,长期还是要系统解决下这类问题,可以考虑加到下下个milestone
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.
并不会很严重吧?其实对于size_t也一样。有的平台是 uint32_t,有的平台是 uint64_t。直接比较就会有问题。需要在比较前强制转型。
这种问题C/C++里面挺常见的。
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.
@gangliao 因为这里
tid
的类型是uint64_t
,所以应该改成CHECK_NE(uint64_t(-1), tid)
。@reyoung @backyes 这里就是应该有type cast,具体原因请参见这里的解释: https://google.github.io/styleguide/cppguide.html#Integer_Types
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.
这里的讨论是为了让这个pr能build过呢?还是让mac port能工作呢?还是也考虑将来的windows port呢?
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.
@wangkuiyi 比较麻烦的是 各大平台获得thread id的方式不大相同。 如果为了统一可以考虑直接改了c++11接口的方式
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.
@gangliao 是的。我理解真要让代码可移植(portable),需要整理代码,使其符合很多编码规范(patterns),比如这里列出了一些。我注意到我们目前的代码还有很多地方不符合这些规范的。如果我们现在开始port,可能要花很多精力在不断涌现的各种不portable的具体例子里。
我想是不是我们先不要支持mac和windows了,先把linux/docker搞定——这样我们可以集中精力先把tutorials,和清华北大的课程(windows和mac上都可以跑docker),以及在各大公有云上跑起来这些事儿先做好,让paddle能被更多的人先用起来,别让做课程以及做运营的同事们等着。随后,我们再来全面整顿代码,使其具备可移植性,然后支持 windows, mac, ios, arm 等平台?
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.
@wangkuiyi 好的,明白了。
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.
@gangliao 我支持提一个建议。我们一起考虑一下,比如周一再定不迟。:-)
如果真的决定如此,我们恐怕得从目前的Build and Install页面里把mac部分的内容删掉呢。