thrust::host
Defined in thrust/execution_policy.h
- 
static const detail::host_t thrust::host
- thrust::hostis the default parallel execution policy associated with Thrust’s host backend system configured by the- THRUST_HOST_SYSTEMmacro.- Instead of relying on implicit algorithm dispatch through iterator system tags, users may directly target algorithm dispatch at Thrust’s host system by providing - thrust::hostas an algorithm parameter.- Explicit dispatch can be useful in avoiding the introduction of data copies into containers such as - thrust::host_vector.- Note that even though - thrust::hosttargets the host CPU, it is a parallel execution policy. That is, the order that an algorithm invokes functors or dereferences iterators is not defined.- The type of - thrust::hostis implementation-defined.- The following code snippet demonstrates how to use - thrust::hostto explicitly dispatch an invocation of- thrust::for_eachto the host backend system:- #include <thrust/for_each.h> #include <thrust/execution_policy.h> #include <cstdio> struct printf_functor { __host__ __device__ void operator()(int x) { printf("%d\n", x); } }; ... int vec[] = { 0, 1, 2 }; thrust::for_each(thrust::host, vec, vec + 3, printf_functor()); // 0 1 2 is printed to standard output in some unspecified order - See also - See also - thrust::device