-
Notifications
You must be signed in to change notification settings - Fork 5.7k
xxx.h, xxx.{cc,cu}, xxx_test.{cc,cu} in the same directory #2251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc_library(place SRCS place.cc) | ||
cc_library(ddim SRCS ddim.cc) | ||
cc_library(place SRCS place/place.cc) | ||
cc_library(ddim SRCS ddim/ddim.cc) | ||
|
||
if(WITH_TESTING) |
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 WITH_TESTING
和 WITH_GPU
等判断是不是可以放在cc_test
和nv_test
的定义里面,这样CMakeLists.txt
看起来会更简洁一些。
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.
cc_library(place SRCS place.cc) | ||
cc_library(ddim SRCS ddim.cc) | ||
cc_library(place SRCS place/place.cc) | ||
cc_library(ddim SRCS ddim/ddim.cc) | ||
|
||
if(WITH_TESTING) |
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.
@@ -1,4 +1,4 @@ | |||
#include "paddle/majel/ddim.h" | |||
#include "paddle/majel/ddim/ddim.h" |
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.
I tend to think that we don't need to move each C++ module into a directory. In C++, a module is defined by a .cc file, optionally with interface declaration in a .h file. We can describe a C++ module by a CMake rule, e.g., cc_library(ddim SRCS ddim.cc)
. So it seems overkilling to move each C++ module into a directory.
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.
I agree that current CMake rule in Paddle majel with cc_library()
and cc_test()
has made module describing quite clearly, therefore simple module like ddim
and place
is not necessery to moved into a directory. However, if a module is really complicated, we should still gather related files up in a subdirectory.
This is my personal understanding, I'm not sure whether it is right ...
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.
I think you are right for the complicated case, e.g., paddle/parameter. For this case, let's move ddim back to paddle/majel
.
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.
Got it. I'm going to close this PR.
fix #2209