   ASSERT_EQUAL(2, (iterator)result[0] - data.begin());
   ASSERT_EQUAL(ref, data);
 }
+
+
+void TestPartitionStencilDeviceSeq()
+{
+  TestPartitionStencilDevice(thrust::seq);
+}
 DECLARE_UNITTEST(TestPartitionStencilDeviceSeq);
 
 
-template<typename Iterator1, typename Iterator2, typename Iterator3, typename Predicate, typename Iterator4>
-__global__
-void partition_copy_kernel(Iterator1 first, Iterator1 last, Iterator2 true_result, Iterator3 false_result, Predicate pred, Iterator4 result)
-{
-  *result = thrust::partition_copy(thrust::seq, first, last, true_result, false_result, pred);
-}
-
-
-void TestPartitionCopyDeviceSeq()
+void TestPartitionStencilDeviceDevice()
+{
+  TestPartitionStencilDevice(thrust::device);
+}
+DECLARE_UNITTEST(TestPartitionStencilDeviceDevice);
+
+
+template<typename ExecutionPolicy, typename Iterator1, typename Iterator2, typename Iterator3, typename Predicate, typename Iterator4>
+__global__
+void partition_copy_kernel(ExecutionPolicy exec, Iterator1 first, Iterator1 last, Iterator2 true_result, Iterator3 false_result, Predicate pred, Iterator4 result)
+{
+  *result = thrust::partition_copy(exec, first, last, true_result, false_result, pred);
+}
+
+
+template<typename ExecutionPolicy>
+void TestPartitionCopyDevice(ExecutionPolicy exec)
 {
   typedef int T;
   typedef thrust::device_vector<T>::iterator iterator;

  ASSERT_EQUAL(true_ref, true_results);
  ASSERT_EQUAL(false_ref, false_results);
}
DECLARE_UNITTEST(TestStablePartitionCopyDeviceSeq);


template<typename Iterator1, typename Iterator2, typename Iterator3, typename Iterator4, typename Predicate, typename Iterator5>
__global__
void stable_partition_copy_kernel(Iterator1 first, Iterator1 last, Iterator2 stencil_first, Iterator3 true_result, Iterator4 false_result, Predicate pred, Iterator5 result)
{
  *result = thrust::stable_partition_copy(thrust::seq, first, last, stencil_first, true_result, false_result, pred);
}


template<typename Vector>
void TestStablePartitionCopyStencilDeviceSeq()
{
  typedef int T;
  

#include <thrust/execution_policy.h>


template<typename ExecutionPolicy, typename Iterator1, typename Predicate, typename Iterator2>
__global__
void partition_kernel(ExecutionPolicy exec, Iterator1 first, Iterator1 last, Predicate pred, Iterator2 result)
{
  *result = thrust::partition(exec, first, last, pred);
}


