Skip to content
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

Need an interface to get Place instance #4203

Closed
Yancey1989 opened this issue Sep 19, 2017 · 0 comments
Closed

Need an interface to get Place instance #4203

Yancey1989 opened this issue Sep 19, 2017 · 0 comments
Assignees

Comments

@Yancey1989
Copy link
Contributor

When I call memory::Copy in Op Kernel, the code like:

paddle::memory::Copy<Place, Place>(
            boost::get<Place>(ctx.GetPlace()), static_cast<void*>(dst),
            boost::get<Place>(ctx.GetPlace()), static_cast<const void*>(src),
            num);

How about add an interface in framework::ExecutionContext named Place():

template<typename T>
inline const T& Place() {
    return boost::get<T>(device_context_->GetPlace());
}

So the code will be chaned into:

paddle::memory::Copy<Place, Place>(
            ctx.Place<Place>(), static_cast<void*>(dst),
            ctx.Place<Place>(), static_cast<const void*>(src),
            num);
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 a pull request may close this issue.

4 participants