seq#

static const detail::seq_t thrust::seq#

thrust::seq is an execution policy which requires an algorithm invocation to execute sequentially in the current thread. It can not be configured by a compile-time macro.

The type of thrust::seq is implementation-defined.

The following code snippet demonstrates how to use thrust::seq to explicitly execute an invocation of thrust::for_each sequentially:

#include <thrust/for_each.h>
#include <thrust/execution_policy.h>
#include <vector>
#include <cstdio>

struct printf_functor
{
  __host__ __device__
  void operator()(int x)
  {
    printf("%d\n", x);
  }
};
...
std::vector<int> vec(3);
vec[0] = 0; vec[1] = 1; vec[2] = 2;

thrust::for_each(thrust::seq, vec.begin(), vec.end(), printf_functor());

// 0 1 2 is printed to standard output in sequential order

See also

thrust::host

See also

thrust::device