Skip to content

Conversation

@chenwhql
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

The code in macro __NVCC__ need to put into .cu file and compiled by nvcc.

#if defined(__NVCC__) || defined(__HIPCC__)
    } else if (platform::is_gpu_place(in_.place())) {
      platform::Transform<platform::CUDADeviceContext> trans;
      auto *context = static_cast<const platform::CUDADeviceContext *>(ctx_);
      trans(*context, in_begin, in_end, out_begin,
            CastDataTypeFunctor<InType, OutType>());
      context->Wait();
#endif

Before this PR, if we call tensor.cast(x) and x.place is kGPU, it will throw error.

e72962a35b5a5e853a5ddc84e251c33d

2e39c354ef9e4a5c6eb151b7a7efe45e

@chenwhql chenwhql requested a review from JiabinYang August 13, 2021 05:42
@chenwhql chenwhql requested a review from zhwesky2010 August 17, 2021 03:11
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

COMMAND ${CMAKE_COMMAND} -E copy_if_different "${final_path}/${src}.cc" "${final_path}/.${src}.cu"
COMMENT "create hidden file of ${src}.cu")
add_custom_target(${TARGET} ALL DEPENDS .${src}.cu)
add_custom_target(${TARGET} ALL DEPENDS ${final_path}/.${src}.cu)
Copy link
Contributor

Choose a reason for hiding this comment

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

LoL, so we have a file named "ext_tensor.cu" for Linux Symlink, and a hidden ".ext_tensor.cu"(actually .ext_tensor.cu.cu) for Windows Symlink. What if there were a third/fourth... platform?

Copy link
Contributor

Choose a reason for hiding this comment

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

src is ext_tensor here. If system is based on Unix, these is no problem generally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should remove these symlink cases later, include data_type_transform, tensor_utils, etc.

@chenwhql chenwhql merged commit 4d88cdb into PaddlePaddle:develop Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants