   thrust::device_vector<T> d_dest(n);
   
   thrust::replace_copy_if(h_data.begin(), h_data.end(), h_stencil.begin(), h_dest.begin(), less_than_five<T>(), 0);
-  replace_copy_if_kernel<<<1,1>>>(d_data.begin(), d_data.end(), d_stencil.begin(), d_dest.begin(), less_than_five<T>(), 0);
+  replace_copy_if_kernel<<<1,1>>>(exec, d_data.begin(), d_data.end(), d_stencil.begin(), d_dest.begin(), less_than_five<T>(), 0);
   
   ASSERT_ALMOST_EQUAL(h_data, d_data);
   ASSERT_ALMOST_EQUAL(h_dest, d_dest);
 }
+
+template<typename T>
+void TestReplaceCopyIfStencilDeviceSeq(const size_t n)
+{
+  TestReplaceCopyIfStencilDevice<T>(thrust::seq, n);
+}
 DECLARE_VARIABLE_UNITTEST(TestReplaceCopyIfStencilDeviceSeq);
 
+template<typename T>
+void TestReplaceCopyIfStencilDeviceDevice(const size_t n)
+{
+  TestReplaceCopyIfStencilDevice<T>(thrust::device, n);
+}
+DECLARE_VARIABLE_UNITTEST(TestReplaceCopyIfStencilDeviceDevice);
+

  thrust::device_vector<T> d_stencil = h_stencil;
  
  thrust::replace_if(h_data.begin(), h_data.end(), h_stencil.begin(), less_than_five<T>(), (T) 0);
  replace_if_kernel<<<1,1>>>(d_data.begin(), d_data.end(), d_stencil.begin(), less_than_five<T>(), (T) 0);
  
  ASSERT_ALMOST_EQUAL(h_data, d_data);
}
DECLARE_VARIABLE_UNITTEST(TestReplaceIfStencilDeviceSeq);


template<typename Iterator1, typename Iterator2, typename Predicate, typename T>
__global__
void replace_copy_if_kernel(Iterator1 first, Iterator1 last, Iterator2 result, Predicate pred, T new_value)
{
  thrust::replace_copy_if(thrust::seq, first, last, result, pred, new_value);
}


template<typename T>
void TestReplaceCopyIfDeviceSeq(const size_t n)
{
  thrust::host_vector<T>   h_data = unittest::random_samples<T>(n);
  thrust::device_vector<T> d_data = h_data;

};


template<typename ExecutionPolicy, typename Iterator, typename T1, typename T2>
__global__
void replace_kernel(ExecutionPolicy exec, Iterator first, Iterator last, T1 old_value, T2 new_value)
{
  thrust::replace(exec, first, last, old_value, new_value);
}


template<typename T, typename ExecutionPolicy>
void TestReplaceDevice(ExecutionPolicy exec, const size_t n)
{
  thrust::host_vector<T>   h_data = unittest::random_samples<T>(n);
  thrust::device_vector<T> d_data = h_data;
