Skip to content

Commit bbe1ec0

Browse files
committed
Remove unnecessary device_ptr_cast()
1 parent 3643260 commit bbe1ec0

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

c++11_cuda/c++11_cuda.cu

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ void xyzw_frequency_thrust_device(int *count, char *text, int n)
5252
{
5353
const char letters[] { 'x','y','z','w' };
5454

55-
auto ptext = thrust::device_pointer_cast(text);
56-
57-
*count = thrust::count_if(thrust::device, ptext, ptext+n, [&](char c) {
55+
*count = thrust::count_if(thrust::device, text, text+n, [&](char c) {
5856
for (const auto x : letters)
5957
if (c == x) return true;
6058
return false;
@@ -99,8 +97,8 @@ int main(int argc, char** argv)
9997
cudaMemset(d_count, 0, sizeof(int));
10098

10199
// Try uncommenting one kernel call at a time
102-
xyzw_frequency<<<8, 256>>>(d_count, d_text, len);
103-
//xyzw_frequency_thrust_device<<<1, 1>>>(d_count, d_text, len);
100+
//xyzw_frequency<<<8, 256>>>(d_count, d_text, len);
101+
xyzw_frequency_thrust_device<<<1, 1>>>(d_count, d_text, len);
104102
cudaMemcpy(&count, d_count, sizeof(int), cudaMemcpyDeviceToHost);
105103

106104
//xyzw_frequency_thrust_host(&count, h_text, len);

0 commit comments

Comments
 (0)