[PATCH] D24429: [test-suite] Add CUDA printf test.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 14:12:10 PDT 2016


jlebar updated this revision to Diff 70905.
jlebar added a comment.

Don't include <iostream>.


https://reviews.llvm.org/D24429

Files:
  External/CUDA/CMakeLists.txt
  External/CUDA/printf.cu
  External/CUDA/printf.reference_output

Index: External/CUDA/printf.reference_output
===================================================================
--- /dev/null
+++ External/CUDA/printf.reference_output
@@ -0,0 +1,17 @@
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+kernel_printf a 2 3 4.000000 5.000000 abcdefg
+exit 0
Index: External/CUDA/printf.cu
===================================================================
--- /dev/null
+++ External/CUDA/printf.cu
@@ -0,0 +1,11 @@
+__global__ void kernel(char a, short b, int c, float d, double e) {
+  const char* f = "abcdefg";
+  printf("kernel_printf %c %d %d %f %f %s\n", a, b, c, d, e, f);
+}
+
+int main(int argc, char* argv[]) {
+  kernel<<<2, 8>>>('a', 2, 3, 4, 5);
+  cudaDeviceSynchronize();
+  cudaDeviceReset();
+  return 0;
+}
Index: External/CUDA/CMakeLists.txt
===================================================================
--- External/CUDA/CMakeLists.txt
+++ External/CUDA/CMakeLists.txt
@@ -46,6 +46,7 @@
 macro(create_local_cuda_tests VariantSuffix)
   create_one_local_test(axpy axpy.cu)
   create_one_local_test(empty empty.cu)
+  create_one_local_test(printf printf.cu)
   create_one_local_test(future future.cu)
 endmacro()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24429.70905.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/34c45e60/attachment.bin>


More information about the llvm-commits mailing list