diff options
author | Brad King <brad.king@kitware.com> | 2017-02-14 15:16:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-02-14 15:20:50 (GMT) |
commit | c4a6135039a417087b478c031849337316022263 (patch) | |
tree | 6b0ce2db3ec8d50fe376edc1021fb52f8e6c8851 /Tests/Cuda/Complex | |
parent | 0b2f8ae3ba4ee6077051c97b503e1a165d4938f2 (diff) | |
download | CMake-c4a6135039a417087b478c031849337316022263.zip CMake-c4a6135039a417087b478c031849337316022263.tar.gz CMake-c4a6135039a417087b478c031849337316022263.tar.bz2 |
Tests: Run clang-format on CUDA code
Diffstat (limited to 'Tests/Cuda/Complex')
-rw-r--r-- | Tests/Cuda/Complex/dynamic.cu | 13 | ||||
-rw-r--r-- | Tests/Cuda/Complex/file1.cu | 2 | ||||
-rw-r--r-- | Tests/Cuda/Complex/file2.cu | 14 | ||||
-rw-r--r-- | Tests/Cuda/Complex/file3.cu | 11 | ||||
-rw-r--r-- | Tests/Cuda/Complex/mixed.cu | 6 |
5 files changed, 17 insertions, 29 deletions
diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu index a23dc25..82255c5 100644 --- a/Tests/Cuda/Complex/dynamic.cu +++ b/Tests/Cuda/Complex/dynamic.cu @@ -1,7 +1,7 @@ -#include <string> #include <cuda.h> #include <iostream> +#include <string> #ifdef _WIN32 #define EXPORT __declspec(dllexport) @@ -16,18 +16,15 @@ EXPORT int __host__ cuda_dynamic_host_func(int x) return dynamic_base_func(x); } -static -__global__ -void DetermineIfValidCudaDevice() +static __global__ void DetermineIfValidCudaDevice() { } EXPORT void cuda_dynamic_lib_func() { - DetermineIfValidCudaDevice <<<1,1>>> (); + DetermineIfValidCudaDevice<<<1, 1>>>(); cudaError_t err = cudaGetLastError(); - if(err == cudaSuccess) - { + if (err == cudaSuccess) { std::cerr << cudaGetErrorString(err) << std::endl; - } + } } diff --git a/Tests/Cuda/Complex/file1.cu b/Tests/Cuda/Complex/file1.cu index a2e8bf3..1ce63bf 100644 --- a/Tests/Cuda/Complex/file1.cu +++ b/Tests/Cuda/Complex/file1.cu @@ -5,6 +5,6 @@ result_type __device__ file1_func(int x) { result_type r; r.input = x; - r.sum = x*x; + r.sum = x * x; return r; } diff --git a/Tests/Cuda/Complex/file2.cu b/Tests/Cuda/Complex/file2.cu index 6b8b06b..74f3558 100644 --- a/Tests/Cuda/Complex/file2.cu +++ b/Tests/Cuda/Complex/file2.cu @@ -5,16 +5,12 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x) { - if(x!=42) - { + if (x != 42) { const result_type r = file1_func(x); - const result_type_dynamic rd { r.input, r.sum, true }; + const result_type_dynamic rd{ r.input, r.sum, true }; return rd; - } - else - { - const result_type_dynamic rd { x, x*x*x, false }; + } else { + const result_type_dynamic rd{ x, x * x * x, false }; return rd; - } - + } } diff --git a/Tests/Cuda/Complex/file3.cu b/Tests/Cuda/Complex/file3.cu index 47e64c5..7c37d66 100644 --- a/Tests/Cuda/Complex/file3.cu +++ b/Tests/Cuda/Complex/file3.cu @@ -7,9 +7,7 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x); -static -__global__ -void file3_kernel(result_type& r, int x) +static __global__ void file3_kernel(result_type& r, int x) { r = file1_func(x); result_type_dynamic rd = file2_func(x); @@ -18,12 +16,11 @@ void file3_kernel(result_type& r, int x) int file3_launch_kernel(int x) { result_type r; - file3_kernel <<<1,1>>> (r,x); + file3_kernel<<<1, 1>>>(r, x); cudaError_t err = cudaGetLastError(); - if(err == cudaSuccess) - { + if (err == cudaSuccess) { std::cerr << cudaGetErrorString(err) << std::endl; return x; - } + } return r.sum; } diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu index 7051de0..4bba07c 100644 --- a/Tests/Cuda/Complex/mixed.cu +++ b/Tests/Cuda/Complex/mixed.cu @@ -17,9 +17,7 @@ result_type_dynamic __device__ file2_func(int x); IMPORT void __host__ cuda_dynamic_lib_func(); -static -__global__ -void mixed_kernel(result_type& r, int x) +static __global__ void mixed_kernel(result_type& r, int x) { r = file1_func(x); result_type_dynamic rd = file2_func(x); @@ -30,6 +28,6 @@ EXPORT int mixed_launch_kernel(int x) cuda_dynamic_lib_func(); result_type r; - mixed_kernel <<<1,1>>> (r,x); + mixed_kernel<<<1, 1>>>(r, x); return r.sum; } |