Skip to content

Commit 316c129

Browse files
committed
Fixed indentation.
1 parent 4b4193a commit 316c129

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

c++11_cuda/c++11_cuda

-103 KB
Binary file not shown.

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ template <typename T, typename Predicate>
2727
__device__
2828
void count_if(int *count, T *data, int n, Predicate p)
2929
{
30-
for (auto i : grid_stride_range(0, n)) {
31-
if (p(data[i])) atomicAdd(count, 1);
32-
}
30+
for (auto i : grid_stride_range(0, n)) {
31+
if (p(data[i])) atomicAdd(count, 1);
32+
}
3333
}
3434

3535
// Use count_if with a lambda function that searches for x, y, z or w
@@ -79,7 +79,7 @@ void xyzw_frequency_thrust_host(int *count, char *text, int n)
7979
#endif
8080

8181
int main(int argc, char** argv)
82-
{
82+
{
8383
const char *filename = "warandpeace.txt";
8484

8585
int numBytes = 16*1048576;
@@ -93,25 +93,25 @@ int main(int argc, char** argv)
9393
fclose(fp);
9494
std::cout << "Read " << len << " byte corpus from " << filename << std::endl;
9595

96-
cudaMemcpy(d_text, h_text, len, cudaMemcpyHostToDevice);
97-
96+
cudaMemcpy(d_text, h_text, len, cudaMemcpyHostToDevice);
97+
9898
int count = 0;
99-
int *d_count;
100-
cudaMalloc(&d_count, sizeof(int));
101-
cudaMemset(d_count, 0, sizeof(int));
99+
int *d_count;
100+
cudaMalloc(&d_count, sizeof(int));
101+
cudaMemset(d_count, 0, sizeof(int));
102102

103103
// Try uncommenting one kernel call at a time
104-
xyzw_frequency<<<8, 256>>>(d_count, d_text, len);
104+
xyzw_frequency<<<8, 256>>>(d_count, d_text, len);
105105
//xyzw_frequency_thrust_device<<<1, 1>>>(d_count, d_text, len);
106106
cudaMemcpy(&count, d_count, sizeof(int), cudaMemcpyDeviceToHost);
107107

108108
//xyzw_frequency_thrust_host(&count, h_text, len);
109109

110-
std::cout << "counted " << count << " instances of 'x', 'y', 'z', or 'w' in \""
111-
<< filename << "\"" << std::endl;
110+
std::cout << "counted " << count << " instances of 'x', 'y', 'z', or 'w' in \""
111+
<< filename << "\"" << std::endl;
112112

113-
cudaFree(d_count);
114-
cudaFree(d_text);
113+
cudaFree(d_count);
114+
cudaFree(d_text);
115115

116-
return 0;
116+
return 0;
117117
}

0 commit comments

Comments
 (0)