diff options
-rw-r--r-- | kernels/test_printf.cl | 13 | ||||
-rw-r--r-- | utests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | utests/test_printf.cpp | 18 |
3 files changed, 32 insertions, 0 deletions
diff --git a/kernels/test_printf.cl b/kernels/test_printf.cl new file mode 100644 index 00000000..3f4c98d1 --- /dev/null +++ b/kernels/test_printf.cl @@ -0,0 +1,13 @@ +__kernel void +test_printf(void) +{ + int x = (int)get_global_id(0); + int y = (int)get_global_id(1); + int z = (int)get_global_id(2); + + if (x % 15 == 0) + if (y % 3 == 0) + if (z % 7 == 0) + printf("######## global_id(x, y, z) = (%d, %d, %d), global_size(d0, d1, d3) = (%d, %d, %d)\n", + x, y, z, get_global_size(0), get_global_size(1), get_global_size(2)); +} diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt index 1c523cba..76bc56e1 100644 --- a/utests/CMakeLists.txt +++ b/utests/CMakeLists.txt @@ -172,6 +172,7 @@ set (utests_sources profiling_exec.cpp enqueue_copy_buf.cpp enqueue_copy_buf_unaligned.cpp + test_printf.cpp utest_assert.cpp utest.cpp utest_file_map.cpp diff --git a/utests/test_printf.cpp b/utests/test_printf.cpp new file mode 100644 index 00000000..ac17d9da --- /dev/null +++ b/utests/test_printf.cpp @@ -0,0 +1,18 @@ +#include "utest_helper.hpp" + +void test_printf(void) +{ + // Setup kernel and buffers + OCL_CREATE_KERNEL("test_printf"); + globals[0] = 16; + locals[0] = 16; + globals[1] = 4; + locals[1] = 4; + globals[2] = 8; + locals[2] = 8; + + // Run the kernel on GPU + OCL_NDRANGE(3); +} + +MAKE_UTEST_FROM_FUNCTION(test_printf); |