[test-suite] r281102 - [test-suite] Add CUDA printf test.

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


Author: jlebar
Date: Fri Sep  9 16:36:46 2016
New Revision: 281102

URL: http://llvm.org/viewvc/llvm-project?rev=281102&view=rev
Log:
[test-suite] Add CUDA printf test.

Summary: Checks that printf() actually does something in CUDA device code.

Reviewers: tra

Subscribers: beanz, llvm-commits

Differential Revision: https://reviews.llvm.org/D24429

Added:
    test-suite/trunk/External/CUDA/printf.cu
    test-suite/trunk/External/CUDA/printf.reference_output
Modified:
    test-suite/trunk/External/CUDA/CMakeLists.txt

Modified: test-suite/trunk/External/CUDA/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/CMakeLists.txt?rev=281102&r1=281101&r2=281102&view=diff
==============================================================================
--- test-suite/trunk/External/CUDA/CMakeLists.txt (original)
+++ test-suite/trunk/External/CUDA/CMakeLists.txt Fri Sep  9 16:36:46 2016
@@ -46,6 +46,7 @@ endmacro()
 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()
 

Added: test-suite/trunk/External/CUDA/printf.cu
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/printf.cu?rev=281102&view=auto
==============================================================================
--- test-suite/trunk/External/CUDA/printf.cu (added)
+++ test-suite/trunk/External/CUDA/printf.cu Fri Sep  9 16:36:46 2016
@@ -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;
+}

Added: test-suite/trunk/External/CUDA/printf.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/printf.reference_output?rev=281102&view=auto
==============================================================================
--- test-suite/trunk/External/CUDA/printf.reference_output (added)
+++ test-suite/trunk/External/CUDA/printf.reference_output Fri Sep  9 16:36:46 2016
@@ -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




More information about the llvm-commits mailing list