File: nvbug_1990211__scan_requires_assignability_from_zero.fixed1.cu

package info (click to toggle)
libthrust 1.17.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,900 kB
  • sloc: ansic: 29,519; cpp: 23,989; python: 1,421; sh: 811; perl: 460; makefile: 112
file content (20 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <thrust/scan.h>
#include <thrust/device_ptr.h>

inline __host__ __device__ uint2 operator+(uint2 a, uint2 b)
{  
  return make_uint2(a.x + b.x, a.y + b.y); 
} 
  
int main() {  
  int num_elements = 32;  
  uint2 *input = NULL, *output = NULL;
  const uint2 zero = make_uint2(0,0);  
  
  thrust::exclusive_scan(thrust::device_ptr<uint2>((uint2*)input), 
                         thrust::device_ptr<uint2>((uint2*)input + num_elements), 
                         thrust::device_ptr<uint2>(output), zero, operator+);  
  
  return 0;  
}