Skip to content

Commit 4cee64b

Browse files
committed
tab to spaces
1 parent a4f2906 commit 4cee64b

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

opencl/common.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void common_create_kernel(
7272
if (NULL != source) {
7373
common_create_program(common, source, options, &common->program);
7474
common->kernel = clCreateKernel(common->program, "kmain", NULL);
75-
assert(NULL != common->kernel);
75+
assert(NULL != common->kernel);
7676
} else {
7777
common->kernel = NULL;
7878
common->program = NULL;
@@ -152,19 +152,19 @@ double common_get_nanos(void) {
152152
}
153153

154154
void common_vec_print_i(int *vec, size_t n) {
155-
size_t i;
156-
for (i = 0; i < n; ++i) {
157-
printf("%d\n", vec[i]);
158-
}
155+
size_t i;
156+
for (i = 0; i < n; ++i) {
157+
printf("%d\n", vec[i]);
158+
}
159159
}
160160

161161
void common_vec_assert_eq_i(int *vec1, int *vec2, size_t n) {
162-
if (memcmp(vec1, vec2, n * sizeof(*vec1)) != 0) {
163-
common_vec_print_i(vec1, n);
164-
puts("");
165-
common_vec_print_i(vec2, n);
166-
assert(0);
167-
}
162+
if (memcmp(vec1, vec2, n * sizeof(*vec1)) != 0) {
163+
common_vec_print_i(vec1, n);
164+
puts("");
165+
common_vec_print_i(vec2, n);
166+
assert(0);
167+
}
168168
}
169169

170170
#endif

opencl/inc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ int main(void) {
3434
cl_platform_id platform;
3535
cl_program program;
3636

37-
/* Run kernel. */
37+
/* Run kernel. */
3838
clGetPlatformIDs(1, &platform, NULL);
3939
clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
4040
context = clCreateContext(NULL, 1, &device, NULL, NULL, NULL);
4141
program = clCreateProgramWithSource(context, 1, &source, NULL, NULL);
42-
clBuildProgram(program, 1, &device, "", NULL, NULL);
42+
clBuildProgram(program, 1, &device, "", NULL, NULL);
4343
kernel = clCreateKernel(program, "kmain", NULL);
4444
buffer = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(cl_int), &input, NULL);
4545
clSetKernelArg(kernel, 0, sizeof(buffer), &buffer);
@@ -49,7 +49,7 @@ int main(void) {
4949
clFinish(command_queue);
5050
clEnqueueReadBuffer(command_queue, buffer, CL_TRUE, 0, sizeof(input), &input, 0, NULL, NULL);
5151

52-
/* Asserts. */
52+
/* Asserts. */
5353
assert(input == 2);
5454

5555
/* Cleanup. */
@@ -59,7 +59,7 @@ int main(void) {
5959
clReleaseKernel(kernel);
6060
clReleaseContext(context);
6161
#ifdef CL_1_2
62-
clReleaseDevice(device);
62+
clReleaseDevice(device);
6363
#endif
6464
return EXIT_SUCCESS;
6565
}

opencl/inc_vector_globals.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ int main(void) {
3838
const size_t nelems_align = global_work_size * group_nelems;
3939
const size_t io_align_sizeof = nelems_align * sizeof(*io_align);
4040

41-
/* Run kernel. */
42-
io_align = malloc(io_align_sizeof);
43-
memcpy(io_align, io, sizeof(io));
41+
/* Run kernel. */
42+
io_align = malloc(io_align_sizeof);
43+
memcpy(io_align, io, sizeof(io));
4444
common_init(&common, source);
4545
clSetKernelArg(common.kernel, 0, sizeof(group_nelems), &group_nelems);
4646
buffer = clCreateBuffer(common.context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, io_align_sizeof, io_align, NULL);
@@ -50,14 +50,14 @@ int main(void) {
5050
clFinish(common.command_queue);
5151
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, io_align_sizeof, io_align, 0, NULL, NULL);
5252

53-
/* Assertions. */
53+
/* Assertions. */
5454
assert(io_align[0] == 2);
5555
assert(io_align[1] == 3);
5656
assert(io_align[2] == 4);
5757
assert(io_align[3] == 5);
5858
assert(io_align[4] == 6);
5959

60-
/* Cleanup. */
60+
/* Cleanup. */
6161
free(io_align);
6262
clReleaseMemObject(buffer);
6363
common_deinit(&common);

opencl/interactive/vec_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
Sample usage:
33
4-
echo '1 2 3' | tr ' ' '\n' >vec_io.vec
5-
./prog vec_io.cl vec_io.vec
4+
echo '1 2 3' | tr ' ' '\n' >vec_io.vec
5+
./prog vec_io.cl vec_io.vec
66
77
Or you can use the default kernel and stdin input:
88
9-
echo '1 2 3' | tr ' ' '\n' | ./prog
9+
echo '1 2 3' | tr ' ' '\n' | ./prog
1010
1111
Generic boilerplate that:
1212

opencl/multi_kernel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main(void) {
2121
Common common;
2222
const size_t global_work_size = sizeof(input) / sizeof(input[0]);
2323

24-
/* Run kernel. */
24+
/* Run kernel. */
2525
common_init(&common, NULL);
2626
common_create_program(&common, source, NULL, &program);
2727
kernel_add = clCreateKernel(program, "add", NULL);
@@ -35,11 +35,11 @@ int main(void) {
3535
clFinish(common.command_queue);
3636
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, sizeof(input), input, 0, NULL, NULL);
3737

38-
/* Assertions. */
38+
/* Assertions. */
3939
assert(input[0] == 4);
4040
assert(input[1] == 6);
4141

42-
/* Cleanup. */
42+
/* Cleanup. */
4343
clReleaseMemObject(buffer);
4444
common_deinit(&common);
4545
return EXIT_SUCCESS;

opencl/pass_by_value.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main(void) {
2020
cl_mem buffer;
2121
Common common;
2222

23-
/* Run kernel. */
23+
/* Run kernel. */
2424
common_init(&common, source);
2525
clSetKernelArg(common.kernel, 0, sizeof(in), &in);
2626
buffer = clCreateBuffer(common.context, CL_MEM_READ_WRITE, sizeof(out), NULL, NULL);
@@ -30,10 +30,10 @@ int main(void) {
3030
clFinish(common.command_queue);
3131
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, sizeof(out), &out, 0, NULL, NULL);
3232

33-
/* Assertions. */
33+
/* Assertions. */
3434
assert(out == 2);
3535

36-
/* Cleanup. */
36+
/* Cleanup. */
3737
clReleaseMemObject(buffer);
3838
common_deinit(&common);
3939
return EXIT_SUCCESS;

opencl/preprocessor.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ but this is a bit nicer.
1010
#include "common.h"
1111

1212
int main(void) {
13-
char options[256];
13+
char options[256];
1414
const char *source =
1515
"__kernel void kmain(__global int *out) {\n"
1616
" out[0] = X;\n"
@@ -21,8 +21,8 @@ int main(void) {
2121
Common common;
2222
const size_t global_work_size = sizeof(io) / sizeof(io[0]);
2323

24-
/* Run kernel. */
25-
snprintf(options, sizeof(options), "-DX=%d", X);
24+
/* Run kernel. */
25+
snprintf(options, sizeof(options), "-DX=%d", X);
2626
common_init_options(&common, source, options);
2727
buffer = clCreateBuffer(common.context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(io), io, NULL);
2828
clSetKernelArg(common.kernel, 0, sizeof(buffer), &buffer);
@@ -31,10 +31,10 @@ int main(void) {
3131
clFinish(common.command_queue);
3232
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, sizeof(io), io, 0, NULL, NULL);
3333

34-
/* Assertions. */
34+
/* Assertions. */
3535
assert(io[0] == X);
3636

37-
/* Cleanup. */
37+
/* Cleanup. */
3838
clReleaseMemObject(buffer);
3939
common_deinit(&common);
4040
return EXIT_SUCCESS;

opencl/vector_type.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main(void) {
2020
Common common;
2121
const size_t global_work_size = sizeof(input) / sizeof(cl_int2);
2222

23-
/* Run kernel. */
23+
/* Run kernel. */
2424
common_init(&common, source);
2525
buffer = clCreateBuffer(common.context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(input), input, NULL);
2626
clSetKernelArg(common.kernel, 0, sizeof(cl_mem), &buffer);
@@ -29,13 +29,13 @@ int main(void) {
2929
clFinish(common.command_queue);
3030
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, sizeof(input), input, 0, NULL, NULL);
3131

32-
/* Assertions. */
32+
/* Assertions. */
3333
assert(input[0] == 1);
3434
assert(input[1] == 2);
3535
assert(input[2] == 3);
3636
assert(input[3] == 4);
3737

38-
/* Cleanup. */
38+
/* Cleanup. */
3939
clReleaseMemObject(buffer);
4040
common_deinit(&common);
4141
return EXIT_SUCCESS;

opencl/write_buffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main(void) {
1616
Common common;
1717
const size_t global_work_size = sizeof(io) / sizeof(io[0]);
1818

19-
/* Setup. */
19+
/* Setup. */
2020
common_init(&common, source);
2121
buffer = clCreateBuffer(common.context, CL_MEM_READ_WRITE, sizeof(io), NULL, NULL);
2222

@@ -43,7 +43,7 @@ int main(void) {
4343
assert(io[0] == 11);
4444
assert(io[1] == 12);
4545

46-
/* Cleanup. */
46+
/* Cleanup. */
4747
clReleaseMemObject(buffer);
4848
common_deinit(&common);
4949
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)