allendaicool / thrust

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

segmented_scan.cu doesn't compile #231

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This one is from the examples.  Using thrust v1.2.1, examples-v1.2.zip, nvcc 
version 3.1, V0.2.1221, and suse 11.2 if that is helpful.  So far, the other 
examples compile fine.

command:
nvcc segmented_scan.cu 

Error:
/usr/local/cuda/bin/../include/thrust/functional.h(834): error: calling a host 
function from a __device__/__global__ function is not allowed
          detected during:                                                                                                                  
            instantiation of "bool thrust::binary_negate<Predicate>::operator()(T, T) [with Predicate=head_flag_predicate<int>, T=int]"     
/usr/local/cuda/bin/../include/thrust/detail/device/generic/transform.inl(75): 
here                                                         
            instantiation of "void thrust::detail::device::generic::detail::binary_transform_functor<BinaryFunction>::operator()(Tuple) [with BinaryFunction=thrust::binary_negate<head_flag_predicate<int>>, Tuple=thrust::tuple<int &, int &, unsigned int &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>]"                                                                                                                                                                                             
/usr/local/cuda/bin/../include/thrust/detail/device/cuda/for_each.inl(71): here 

            instantiation of "void thrust::detail::device::cuda::for_each_n_closure<RandomAccessIterator, Size, UnaryFunction>::operator()() [with RandomAccessIterator=thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<unsigned int>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, Size=ptrdiff_t, UnaryFunction=thrust::detail::device::generic::detail::binary_transform_functor<thrust::binary_negate<head_flag_predicate<int>>>]"                                                                                                         
/usr/local/cuda/bin/../include/thrust/detail/device/cuda/launch_closure.inl(47):
 here                                                                           

            instantiation of "void thrust::detail::device::cuda::detail::launch_closure_by_value(NullaryFunction) [with NullaryFunction=thrust::detail::device::cuda::for_each_n_closure<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<unsigned int>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, ptrdiff_t, thrust::detail::device::generic::detail::binary_transform_functor<thrust::binary_negate<head_flag_predicate<int>>>>]"                                                                                                          
/usr/local/cuda/bin/../include/thrust/detail/device/cuda/launch_closure.inl(66):
 here                                                                           

            instantiation of "void thrust::detail::device::cuda::detail::closure_launcher<NullaryFunction, launch_by_value>::launch(NullaryFunction, Size) [with NullaryFunction=thrust::detail::device::cuda::for_each_n_closure<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<int>>, thrust::detail::normal_iterator<thrust::device_ptr<unsigned int>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, ptrdiff_t, thrust::detail::device::generic::detail::binary_transform_functor<thrust::binary_negate<head_flag_predicate<int>>>>, launch_by_value=true, Size=int]"                                 
/usr/local/cuda/bin/../include/thrust/detail/device/cuda/launch_closure.inl(106)
: here                                                                          

            [ 7 instantiation contexts not shown ]                                                                                                                                               
            instantiation of "OutputIterator thrust::transform(InputIterator1, InputIterator1, InputIterator2, OutputIterator, BinaryFunction) [with InputIterator1=thrust::detail::normal_iterator<thrust::device_ptr<int>>, InputIterator2=thrust::detail::normal_iterator<thrust::device_ptr<int>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<unsigned int>>, BinaryFunction=thrust::binary_negate<head_flag_predicate<int>>]"
/usr/local/cuda/bin/../include/thrust/detail/device/generic/segmented_scan.inl(8
1): here
            instantiation of "OutputIterator thrust::detail::device::generic::inclusive_segmented_scan(InputIterator1, InputIterator1, InputIterator2, OutputIterator, AssociativeOperator, BinaryPredicate) [with InputIterator1=thrust::detail::normal_iterator<thrust::device_ptr<int>>, InputIterator2=thrust::detail::normal_iterator<thrust::device_ptr<int>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<int>>, AssociativeOperator=thrust::plus<int>, BinaryPredicate=head_flag_predicate<int>]"
/usr/local/cuda/bin/../include/thrust/detail/device/segmented_scan.h(46): here
            instantiation of "OutputIterator thrust::detail::device::inclusive_segmented_scan(InputIterator1, InputIterator1, InputIterator2, OutputIterator, AssociativeOperator, BinaryPredicate) [with InputIterator1=thrust::detail::normal_iterator<thrust::device_ptr<int>>, InputIterator2=thrust::detail::normal_iterator<thrust::device_ptr<int>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<int>>, AssociativeOperator=thrust::plus<int>, BinaryPredicate=head_flag_predicate<int>]"
/usr/local/cuda/bin/../include/thrust/detail/dispatch/segmented_scan.h(101): 
here
            instantiation of "OutputIterator thrust::detail::dispatch::inclusive_segmented_scan(InputIterator1, InputIterator1, InputIterator2, OutputIterator, AssociativeOperator, BinaryPredicate, thrust::device_space_tag, thrust::device_space_tag, thrust::device_space_tag) [with InputIterator1=thrust::detail::normal_iterator<thrust::device_ptr<int>>, InputIterator2=thrust::detail::normal_iterator<thrust::device_ptr<int>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<int>>, AssociativeOperator=thrust::plus<int>, BinaryPredicate=head_flag_predicate<int>]"
/usr/local/cuda/bin/../include/thrust/detail/segmented_scan.inl(79): here
            instantiation of "OutputIterator thrust::experimental::inclusive_segmented_scan(InputIterator1, InputIterator1, InputIterator2, OutputIterator, AssociativeOperator, BinaryPredicate) [with InputIterator1=thrust::detail::normal_iterator<thrust::device_ptr<int>>, InputIterator2=thrust::detail::normal_iterator<thrust::device_ptr<int>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<int>>, AssociativeOperator=thrust::plus<int>, BinaryPredicate=head_flag_predicate<int>]"
segmented_scan.cu(46): here

1 error detected in the compilation of 
"/tmp/tmpxft_00003fce_00000000-4_segmented_scan.cpp1.ii".

Original issue reported on code.google.com by EricSpan...@gmail.com on 28 Sep 2010 at 9:21

GoogleCodeExporter commented 9 years ago
Should be fixed in Thrust v1.4 and newer

Original comment by wnbell on 21 Aug 2011 at 10:44