Skip to content

Define cc_xxx and nv_xxx to simplify cmake#2174

Merged
wangkuiyi merged 6 commits intoPaddlePaddle:developfrom
gangliao:define_cmake
May 17, 2017
Merged

Define cc_xxx and nv_xxx to simplify cmake#2174
wangkuiyi merged 6 commits intoPaddlePaddle:developfrom
gangliao:define_cmake

Conversation

@gangliao
Copy link
Contributor

@gangliao gangliao commented May 17, 2017

You can verify this feature.

cmake ..
make majel
make place_test
make cuda_test
ctest -V -R place_test
ctest -V -R cuda_test

go is different, it's better to create a new pull request

@gangliao gangliao requested review from helinwang and wangkuiyi May 17, 2017 05:14
@gangliao
Copy link
Contributor Author

gangliao commented May 17, 2017

@gangliao gangliao changed the title Define cc_xxx to simplify cmake May 17, 2017
}

__global__ void vecAdd (float* d_A, float* d_B, float* d_C, int n) {
__global__ void vecAdd(float *d_A, float *d_B, float *d_C, int n) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that clang-format can work correctly on cuda source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wangkuiyi Shall we also format paddle's CUDA files?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great! Let's do it!

Copy link
Collaborator

@wangkuiyi wangkuiyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

The only question is that it seems that all targets depend on ${external_project_dependencies}. I created an issue #2185 about this.

else()
cuda_add_library(${TARGET_NAME} STATIC ${nv_library_SRCS})
endif()
add_dependencies(${TARGET_NAME} ${nv_library_DEPS} ${external_project_dependencies})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to grep for "external_project_dependencies", but I cannot find it anywhere in *.cmake and CMakeLists.txt files. I Googled it, but cannot find it in CMake's document. Where was this variable defined?

else()
cuda_add_library(${TARGET_NAME} STATIC ${nv_library_SRCS})
endif()
add_dependencies(${TARGET_NAME} ${nv_library_DEPS} ${external_project_dependencies})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this line, and similar lines in other functions, mean that every library and test depends on all external projects? I am a little afraid that this could be too heavy?

function(cc_library TARGET_NAME)
set(options OPTIONAL)
set(oneValueArgs "")
set(multiValueArgs SRCS DEPS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just be curious: I noticed that these three lines

set(options OPTIONAL)
set(oneValueArgs "")
set(multiValueArgs SRCS DEPS)

appear in all these functions. Can we move them out of these functions as we write global variables? -- I know global variables are not a good idea; I am just curious.

@wangkuiyi wangkuiyi merged commit 0a4b540 into PaddlePaddle:develop May 17, 2017
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
fsylmxx pushed a commit to fsylmxx/Paddle that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants