lion03 / thrust

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

compilation Error while trying to call make_pair_functor() #278

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
#include <cuda.h>
#include <thrust/pair.h>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <thrust/tuple.h>
#include <thrust/device_ptr.h>
#include <thrust/fill.h>
#include <sys/time.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/reduce.h>
#include <thrust/functional.h>
#include <iostream>
#include <iterator>
#include <string>
#include <unittest/unittest.h>
#include <unittest/testframework.h>
#include <thrust/transform_scan.h>
#include <thrust/adjacent_difference.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/zip_iterator.h>
struct make_pair_functor
{
template <typename T1, typename T2>
  __host__ __device__
    thrust::pair<T1,T2> operator()(const T1 &x, const T2 &y)
  {
    return thrust::make_pair(x,y);
  } // end operator()()
}; // end make_pair_functor

struct add_pairs
{
  template <typename Pair1, typename Pair2>
  __host__ __device__
    Pair1 operator()(const Pair1 &x, const Pair2 &y)
  {
    return thrust::make_pair(x.first + y.first, x.second + y.second);
  } // end operator()
}; // end add_pairs

int main()
{

    typedef thrust::pair<float,float> P;
     // zip up pairs on the host
     thrust::transform(d_vec.begin(), d_vec.end(), data.begin(), d_result.begin(), make_pair_functor());
     thrust::device_vector<P> d_pairs = d_result;
     thrust::inclusive_scan(d_pairs.begin(), d_pairs.end(), d_result.begin(), add_pairs());
}

Original issue reported on code.google.com by vinitha....@gmail.com on 12 Nov 2010 at 6:46

Attachments:

GoogleCodeExporter commented 8 years ago
hello,
Could you please tell me what the error could possibly be??

Original comment by vinitha....@gmail.com on 12 Nov 2010 at 11:33

GoogleCodeExporter commented 8 years ago
Hi Vinitha,
Please raise these sorts of questions on the thrust-users mailing list [1], not 
on our bug tracker.

[1] http://groups.google.com/group/thrust-users

Original comment by jaredhoberock on 12 Nov 2010 at 11:36