回答編集履歴

1

修正

2021/07/11 07:40

投稿

episteme
episteme

スコア16612

test CHANGED
@@ -34,27 +34,17 @@
34
34
 
35
35
 
36
36
 
37
- thrust::device_vector<char> d_A(n);
37
+ thrust::device_vector<char> d_A(A, A+n);
38
38
 
39
39
  thrust::device_vector<char> d_B(n);
40
40
 
41
- thrust::device_vector<int> d_C(n);
41
+ thrust::device_vector<int> d_C(C, C+n);
42
-
43
-
44
-
45
- thrust::copy(A, A+n, d_A.begin());
46
-
47
- thrust::copy(C, C+n, d_C.begin());
48
42
 
49
43
 
50
44
 
51
45
  dim3 block(8, 1);
52
46
 
53
47
  dim3 grid((n + block.x - 1) / block.x, 1);
54
-
55
- char* pd_B = thrust::raw_pointer_cast(&d_B[0]);
56
-
57
-
58
48
 
59
49
  test<<<grid, block >>>(
60
50
 
@@ -68,9 +58,7 @@
68
58
 
69
59
 
70
60
 
71
- thrust::host_vector<char> h_B(n);
61
+ thrust::host_vector<char> h_B = d_B;
72
-
73
- thrust::copy(d_B.begin(), d_B.end(), h_B.begin());
74
62
 
75
63
 
76
64
 
@@ -82,4 +70,6 @@
82
70
 
83
71
  }
84
72
 
73
+
74
+
85
75
  ```