-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add cmake for majel #2118
Add cmake for majel #2118
Changes from 4 commits
b0f070e
3a73455
9c501e9
92e0c89
d8c8f41
05b3196
d444251
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,14 @@ add_subdirectory(pserver) | |
add_subdirectory(trainer) | ||
add_subdirectory(scripts) | ||
|
||
find_package(boost QUIET) | ||
|
||
if(Boost_FOUND) | ||
include_directories(${Boost_INCLUDE_DIRS}) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我对cmake不是很熟悉,为何这里要把当前目录给include了? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explained in #2122 |
||
add_subdirectory(majel) | ||
endif() | ||
|
||
if(WITH_C_API) | ||
add_subdirectory(capi) | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
set(MAJEL_CXX_FILES place.cpp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PADDLE includes both CPU and GPU versions. If CMake detects the host machine equipped GPUs, it will invoke NOTE: The suffix of unit test files should strictly limit to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we are going to port Majel to Paddle, I think we will have to enable GPU and CPU versions. Also, we'll have to be able to specify which one to build, as we do with Paddle. Also, I think we shouldn't assume that the development computer having a GPU means that the runtime environment would have GPUs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree that if a source file doesn't include CUDA code, the suffix shouldn't be .cu. But I personally prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explained in #2122 |
||
set(MAJEL_CUDA_FILES "") | ||
|
||
if(CUDA_FOUND) | ||
cuda_add_library(majel ${MAJEL_CUDA_FILES} ${MAJEL_CXX_FILES}) | ||
else() | ||
add_library(majel ${MAJEL_CXX_FILES}) | ||
endif() | ||
|
||
file(GLOB_RECURSE CHECK_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cpp" "*.h") | ||
add_style_check_target(majel ${CHECK_FILES}) | ||
|
||
if(WITH_TESTING) | ||
add_subdirectory(test) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
file(GLOB_RECURSE ALL_TEST_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cpp" "*.cc") | ||
|
||
add_executable(majel_tests ${ALL_TEST_FILES}) | ||
add_dependencies(majel_tests majel ${external_project_dependencies}) | ||
target_link_libraries(majel_tests | ||
${Boost_LIBRARIES} | ||
${GTEST_LIBRARIES} | ||
majel | ||
) | ||
add_test(majel_tests majel_tests) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "gtest/gtest.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we need this file? I think we can just link There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explained in #2122 |
||
|
||
int main(int argc, char** argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
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.
我记得design doc里说用轻量级的boost替代品,这里仍然是用的boost吗?
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.
这里是boost,不是替代品。
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.
Explained in #2122