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

thrust adaptor #40

Open
lgarithm opened this issue Jul 8, 2019 · 1 comment
Open

thrust adaptor #40

lgarithm opened this issue Jul 8, 2019 · 1 comment

Comments

@lgarithm
Copy link
Collaborator

lgarithm commented Jul 8, 2019

template <template <typename, ttl::rank_t, typename> class T, typename R,
          ttl::rank_t r, typename S>
thrust::device_ptr<R> begin(const T<R, r, S> &t)
{
    R *d = const_cast<R *>(t.data());
    thrust::device_ptr<R> p = thrust::device_pointer_cast(d);
    return p;
}

template <template <typename, ttl::rank_t, typename> class T, typename R,
          ttl::rank_t r, typename S>
thrust::device_ptr<R> end(const T<R, r, S> &t)
{
    R *d = const_cast<R *>(t.data_end());
    thrust::device_ptr<R> p = thrust::device_pointer_cast(d);
    return p;
}
@lgarithm
Copy link
Collaborator Author

lgarithm commented Sep 6, 2019

thrust::device_vector<R> y(n);

R* p = thrust::raw_pointer_cast(y.data());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant