malenie / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

The non-nvcc path of cuda::detail::copy_device_to_device illegally calls thrust::transform #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here's the body of the function:

template<typename InputIterator,
         typename OutputIterator>
  OutputIterator copy_device_to_device(InputIterator begin, 
                                       InputIterator end, 
                                       OutputIterator result,
                                       thrust::detail::false_type)
{
    // general case (mixed types)
    typedef typename thrust::iterator_traits<InputIterator>::value_type 
InputType;

#ifdef __CUDACC__
    return thrust::detail::device::transform(begin, end, result, 
thrust::identity<InputType>());
#else
    // we're not compiling with nvcc: copy [begin, end) to temp host memory
    typename thrust::iterator_traits<InputIterator>::difference_type n = 
thrust::distance(begin, end);

    raw_buffer<InputType, host_space_tag> temp1(begin, end);

    // transform temp1 to OutputType in host memory
    typedef typename thrust::iterator_traits<OutputIterator>::value_type 
OutputType;
    raw_buffer<OutputType, host_space_tag> temp2(n);
    thrust::transform(temp1.begin(), temp1.end(), temp2.begin(), 
thrust::identity<InputType>());

    // copy temp2 to device
    result = thrust::detail::device::cuda::copy_cross_space(temp2.begin(), 
temp2.end(), result);

    return result;
#endif // __CUDACC__
}

obviously we can't call transform [1] unless we're compiling with nvcc

[1] 
http://code.google.com/p/thrust/source/browse/trunk/thrust/detail/device/cu
da/copy_device_to_device.h#75

Original issue reported on code.google.com by jaredhoberock on 7 Jan 2010 at 1:36

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r710.

Original comment by jaredhoberock on 11 Jan 2010 at 7:59