 
   thrust::device_vector<typename Vector::iterator> iter_vec(1);
   
-  transform_if_kernel<<<1,1>>>(input.begin(), input.end(),
+  transform_if_kernel<<<1,1>>>(exec,
+                               input.begin(), input.end(),
                                output.begin(),
                                thrust::negate<T>(),
                                thrust::identity<T>(),

#include <thrust/execution_policy.h>


template<typename Iterator1, typename Iterator2, typename Function, typename Iterator3>
__global__
void transform_kernel(Iterator1 first, Iterator1 last, Iterator2 result1, Function f, Iterator3 result2)
{
  *result2 = thrust::transform(thrust::seq, first, last, result1, f);
}


void TestTransformUnaryDeviceSeq()
{
  typedef thrust::device_vector<int> Vector;
  typedef typename Vector::value_type T;

  result[0]  =  5; result[1]  =  2; result[2]  = -3;
  
  thrust::identity<T> identity;

  thrust::device_vector<typename Vector::iterator> iter_vec(1);
  
  transform_if_kernel<<<1,1>>>(exec,
                               input1.begin(), input1.end(),
                               input2.begin(),
                               stencil.begin(),
                               output.begin(),
                               thrust::minus<T>(),
                               thrust::not1(identity),
                               iter_vec.begin());
  iter = iter_vec[0];
  
  ASSERT_EQUAL(iter - output.begin(), input1.size());
  ASSERT_EQUAL(output, result);
}

void TestTransformIfBinaryDeviceSeq()
{
  TestTransformIfBinaryDevice(thrust::seq);
}
DECLARE_UNITTEST(TestTransformIfBinaryDeviceSeq);

void TestTransformIfBinaryDeviceDevice()
{
  TestTransformIfBinaryDevice(thrust::device);
}
DECLARE_UNITTEST(TestTransformIfBinaryDeviceDevice);

