[Cmake-commits] CMake branch, next, updated. v3.8.0-rc1-136-gc415052
Brad King
brad.king at kitware.com
Tue Feb 14 10:31:27 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via c415052b368c6b1dd822332b443f896841804d0e (commit)
via 1009e1d708212d939feda5e761ce758d20fb3752 (commit)
via 33a65941fa5d7c12d79f9a4e002fed418ba6adc7 (commit)
via fa5188d0edf081396ca0134d07cd8706549ddede (commit)
via c4a6135039a417087b478c031849337316022263 (commit)
via 0b2f8ae3ba4ee6077051c97b503e1a165d4938f2 (commit)
via 592e3d2f96850365ee6d17989c1bca55049cfd23 (commit)
from 726660c22aa5116222cc0b5d713899b8fac92a24 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c415052b368c6b1dd822332b443f896841804d0e
commit c415052b368c6b1dd822332b443f896841804d0e
Merge: 726660c 1009e1d
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:31:26 2017 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Feb 14 10:31:26 2017 -0500
Merge topic 'clang-format-cuda' into next
1009e1d7 Merge branch 'backport-clang-format-cuda' into clang-format-cuda
33a65941 Tests: Run clang-format on CUDA code
fa5188d0 Merge branch 'backport-clang-format-cuda' into clang-format-cuda
c4a61350 Tests: Run clang-format on CUDA code
0b2f8ae3 Modules: Run clang-format on CUDA code
592e3d2f clang-format.bash: Format CUDA source files too
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1009e1d708212d939feda5e761ce758d20fb3752
commit 1009e1d708212d939feda5e761ce758d20fb3752
Merge: 33a6594 c4a6135
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:22:22 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:22:22 2017 -0500
Merge branch 'backport-clang-format-cuda' into clang-format-cuda
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33a65941fa5d7c12d79f9a4e002fed418ba6adc7
commit 33a65941fa5d7c12d79f9a4e002fed418ba6adc7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:16:32 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:21:48 2017 -0500
Tests: Run clang-format on CUDA code
diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu
index 2b04ac9..f677868 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,9 +16,7 @@ EXPORT int __host__ cuda_dynamic_host_func(int x)
return dynamic_base_func(x);
}
-static
-__global__
-void DetermineIfValidCudaDevice()
+static __global__ void DetermineIfValidCudaDevice()
{
}
@@ -26,35 +24,28 @@ EXPORT int choose_cuda_device()
{
int nDevices = 0;
cudaError_t err = cudaGetDeviceCount(&nDevices);
- if (err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "Failed to retrieve the number of CUDA enabled devices"
<< std::endl;
return 1;
- }
- for (int i = 0; i < nDevices; ++i)
- {
+ }
+ for (int i = 0; i < nDevices; ++i) {
cudaDeviceProp prop;
cudaError_t err = cudaGetDeviceProperties(&prop, i);
- if (err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "Could not retrieve properties from CUDA device " << i
<< std::endl;
return 1;
- }
- if (prop.major >= 4)
- {
- err = cudaSetDevice(i);
- if (err != cudaSuccess)
- {
- std::cout << "Could not select CUDA device " << i << std::endl;
- }
- else
- {
- return 0;
- }
+ }
+ if (prop.major >= 4) {
+ err = cudaSetDevice(i);
+ if (err != cudaSuccess) {
+ std::cout << "Could not select CUDA device " << i << std::endl;
+ } else {
+ return 0;
}
}
+ }
std::cout << "Could not find a CUDA enabled card supporting compute >=3.0"
<< std::endl;
@@ -64,17 +55,15 @@ EXPORT int choose_cuda_device()
EXPORT void cuda_dynamic_lib_func()
{
- DetermineIfValidCudaDevice <<<1,1>>> ();
+ DetermineIfValidCudaDevice<<<1, 1>>>();
cudaError_t err = cudaGetLastError();
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "DetermineIfValidCudaDevice [SYNC] failed: "
<< cudaGetErrorString(err) << std::endl;
- }
+ }
err = cudaDeviceSynchronize();
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "DetermineIfValidCudaDevice [ASYNC] failed: "
<< cudaGetErrorString(cudaGetLastError()) << 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 bd8198d..d055b42 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);
@@ -19,36 +17,32 @@ int file3_launch_kernel(int x)
{
result_type* r;
cudaError_t err = cudaMallocManaged(&r, sizeof(result_type));
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "file3_launch_kernel: cudaMallocManaged failed: "
<< cudaGetErrorString(err) << std::endl;
return x;
- }
+ }
- file3_kernel <<<1,1>>> (r,x);
+ file3_kernel<<<1, 1>>>(r, x);
err = cudaGetLastError();
- if(err != cudaSuccess)
- {
- std::cerr << "file3_kernel [SYNC] failed: "
- << cudaGetErrorString(err) << std::endl;
+ if (err != cudaSuccess) {
+ std::cerr << "file3_kernel [SYNC] failed: " << cudaGetErrorString(err)
+ << std::endl;
return x;
- }
+ }
err = cudaDeviceSynchronize();
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "file3_kernel [ASYNC] failed: "
<< cudaGetErrorString(cudaGetLastError()) << std::endl;
return x;
- }
+ }
int result = r->sum;
err = cudaFree(r);
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "file3_launch_kernel: cudaFree failed: "
<< cudaGetErrorString(err) << std::endl;
return x;
- }
+ }
return result;
}
diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu
index d96cc7c..a81ccb7 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);
@@ -31,37 +29,33 @@ EXPORT int mixed_launch_kernel(int x)
result_type* r;
cudaError_t err = cudaMallocManaged(&r, sizeof(result_type));
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "mixed_launch_kernel: cudaMallocManaged failed: "
<< cudaGetErrorString(err) << std::endl;
return x;
- }
+ }
- mixed_kernel <<<1,1>>> (r,x);
+ mixed_kernel<<<1, 1>>>(r, x);
err = cudaGetLastError();
- if(err != cudaSuccess)
- {
- std::cerr << "mixed_kernel [SYNC] failed: "
- << cudaGetErrorString(err) << std::endl;
+ if (err != cudaSuccess) {
+ std::cerr << "mixed_kernel [SYNC] failed: " << cudaGetErrorString(err)
+ << std::endl;
return x;
- }
+ }
err = cudaDeviceSynchronize();
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "mixed_kernel [ASYNC] failed: "
<< cudaGetErrorString(cudaGetLastError()) << std::endl;
return x;
- }
+ }
int result = r->sum;
err = cudaFree(r);
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "mixed_launch_kernel: cudaFree failed: "
<< cudaGetErrorString(err) << std::endl;
return x;
- }
+ }
return result;
}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/main.cu b/Tests/Cuda/ConsumeCompileFeatures/main.cu
index 712871c..bc32450 100644
--- a/Tests/Cuda/ConsumeCompileFeatures/main.cu
+++ b/Tests/Cuda/ConsumeCompileFeatures/main.cu
@@ -5,14 +5,16 @@ int static_cxx11_func(int);
void test_functions()
{
- auto x = static_cxx11_func( int(42) );
+ auto x = static_cxx11_func(int(42));
std::cout << x << std::endl;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
- std::cout << "this executable doesn't use cuda code, just call methods defined" << std::endl;
+ std::cout
+ << "this executable doesn't use cuda code, just call methods defined"
+ << std::endl;
std::cout << "in libraries that have cuda code" << std::endl;
return 0;
}
diff --git a/Tests/Cuda/ObjectLibrary/static.cu b/Tests/Cuda/ObjectLibrary/static.cu
index a801153..aa35729 100644
--- a/Tests/Cuda/ObjectLibrary/static.cu
+++ b/Tests/Cuda/ObjectLibrary/static.cu
@@ -8,14 +8,14 @@ int __host__ file1_sq_func(int x)
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cerr << "nDevices: " << nDevices << std::endl;
std::cerr << "err: " << err << std::endl;
return 1;
}
std::cout << "this library uses cuda code" << std::endl;
- std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;
+ std::cout << "you have " << nDevices << " devices that support cuda"
+ << std::endl;
return x * x;
}
diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu
index d93dc9f..9a105f0 100644
--- a/Tests/Cuda/ProperLinkFlags/file1.cu
+++ b/Tests/Cuda/ProperLinkFlags/file1.cu
@@ -6,6 +6,6 @@ result_type __device__ file1_func(int x)
__ldg(&x);
result_type r;
r.input = x;
- r.sum = x*x;
+ r.sum = x * x;
return r;
}
diff --git a/Tests/CudaOnly/EnableStandard/main.cu b/Tests/CudaOnly/EnableStandard/main.cu
index f7144e6..f219583 100644
--- a/Tests/CudaOnly/EnableStandard/main.cu
+++ b/Tests/CudaOnly/EnableStandard/main.cu
@@ -12,11 +12,11 @@ IMPORT int shared_cuda11_func(int);
void test_functions()
{
- static_cuda11_func( int(42) );
- shared_cuda11_func( int(42) );
+ static_cuda11_func(int(42));
+ shared_cuda11_func(int(42));
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
return 0;
diff --git a/Tests/CudaOnly/SeparateCompilation/file1.cu b/Tests/CudaOnly/SeparateCompilation/file1.cu
index a2e8bf3..1ce63bf 100644
--- a/Tests/CudaOnly/SeparateCompilation/file1.cu
+++ b/Tests/CudaOnly/SeparateCompilation/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/CudaOnly/SeparateCompilation/file2.cu b/Tests/CudaOnly/SeparateCompilation/file2.cu
index 6b8b06b..74f3558 100644
--- a/Tests/CudaOnly/SeparateCompilation/file2.cu
+++ b/Tests/CudaOnly/SeparateCompilation/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/CudaOnly/SeparateCompilation/file3.cu b/Tests/CudaOnly/SeparateCompilation/file3.cu
index 670a18b..155b513 100644
--- a/Tests/CudaOnly/SeparateCompilation/file3.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file3.cu
@@ -6,13 +6,10 @@
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)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +17,6 @@ void file3_kernel(result_type& r, int x)
result_type file3_launch_kernel(int x)
{
result_type r;
- file3_kernel <<<1,1>>> (r,x);
+ file3_kernel<<<1, 1>>>(r, x);
return r;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu
index 86ef623..2e3e01e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file4.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file4.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file4_kernel(result_type& r, int x)
+static __global__ void file4_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file4_kernel(result_type& r, int x)
int file4_launch_kernel(int x)
{
result_type r;
- file4_kernel <<<1,1>>> (r,x);
+ file4_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu
index 6fdb32a..fee8e9e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file5.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file5.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file5_kernel(result_type& r, int x)
+static __global__ void file5_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file5_kernel(result_type& r, int x)
int file5_launch_kernel(int x)
{
result_type r;
- file5_kernel <<<1,1>>> (r,x);
+ file5_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/main.cu b/Tests/CudaOnly/SeparateCompilation/main.cu
index 5c8e150..03e0921 100644
--- a/Tests/CudaOnly/SeparateCompilation/main.cu
+++ b/Tests/CudaOnly/SeparateCompilation/main.cu
@@ -7,7 +7,7 @@
int file4_launch_kernel(int x);
int file5_launch_kernel(int x);
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
file4_launch_kernel(42);
file5_launch_kernel(42);
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
index 67bf10c..80ed3a5 100644
--- a/Tests/CudaOnly/WithDefs/main.notcu
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -6,14 +6,12 @@
#error "PACKED_DEFINE not defined!"
#endif
-static
-__global__
-void DetermineIfValidCudaDevice()
+static __global__ void DetermineIfValidCudaDevice()
{
}
#ifdef _MSC_VER
-#pragma pack(push,1)
+#pragma pack(push, 1)
#undef PACKED_DEFINE
#define PACKED_DEFINE
#endif
@@ -32,28 +30,24 @@ struct PACKED_DEFINE result_type
result_type can_launch_kernel()
{
result_type r;
- DetermineIfValidCudaDevice <<<1,1>>> ();
+ DetermineIfValidCudaDevice<<<1, 1>>>();
r.valid = (cudaSuccess == cudaGetLastError());
- if(r.valid)
- {
+ if (r.valid) {
r.value = 1;
- }
- else
- {
+ } else {
r.value = -1;
- }
+ }
return r;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
- std::cerr << cudaGetErrorString(err) << std::endl;
- return 1;
- }
+ if (err != cudaSuccess) {
+ std::cerr << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
return 0;
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa5188d0edf081396ca0134d07cd8706549ddede
commit fa5188d0edf081396ca0134d07cd8706549ddede
Merge: 03be8cc 0b2f8ae
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:21:22 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:21:22 2017 -0500
Merge branch 'backport-clang-format-cuda' into clang-format-cuda
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4a6135039a417087b478c031849337316022263
commit c4a6135039a417087b478c031849337316022263
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:16:32 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:20:50 2017 -0500
Tests: Run clang-format on CUDA code
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;
}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/main.cu b/Tests/Cuda/ConsumeCompileFeatures/main.cu
index 712871c..bc32450 100644
--- a/Tests/Cuda/ConsumeCompileFeatures/main.cu
+++ b/Tests/Cuda/ConsumeCompileFeatures/main.cu
@@ -5,14 +5,16 @@ int static_cxx11_func(int);
void test_functions()
{
- auto x = static_cxx11_func( int(42) );
+ auto x = static_cxx11_func(int(42));
std::cout << x << std::endl;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
- std::cout << "this executable doesn't use cuda code, just call methods defined" << std::endl;
+ std::cout
+ << "this executable doesn't use cuda code, just call methods defined"
+ << std::endl;
std::cout << "in libraries that have cuda code" << std::endl;
return 0;
}
diff --git a/Tests/Cuda/ObjectLibrary/static.cu b/Tests/Cuda/ObjectLibrary/static.cu
index 2374c23..cdf682b 100644
--- a/Tests/Cuda/ObjectLibrary/static.cu
+++ b/Tests/Cuda/ObjectLibrary/static.cu
@@ -8,14 +8,14 @@ int __host__ file1_sq_func(int x)
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cout << "nDevices: " << nDevices << std::endl;
std::cout << "err: " << err << std::endl;
return 1;
}
std::cout << "this library uses cuda code" << std::endl;
- std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;
+ std::cout << "you have " << nDevices << " devices that support cuda"
+ << std::endl;
return x * x;
}
diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu
index d93dc9f..9a105f0 100644
--- a/Tests/Cuda/ProperLinkFlags/file1.cu
+++ b/Tests/Cuda/ProperLinkFlags/file1.cu
@@ -6,6 +6,6 @@ result_type __device__ file1_func(int x)
__ldg(&x);
result_type r;
r.input = x;
- r.sum = x*x;
+ r.sum = x * x;
return r;
}
diff --git a/Tests/CudaOnly/EnableStandard/main.cu b/Tests/CudaOnly/EnableStandard/main.cu
index f7144e6..f219583 100644
--- a/Tests/CudaOnly/EnableStandard/main.cu
+++ b/Tests/CudaOnly/EnableStandard/main.cu
@@ -12,11 +12,11 @@ IMPORT int shared_cuda11_func(int);
void test_functions()
{
- static_cuda11_func( int(42) );
- shared_cuda11_func( int(42) );
+ static_cuda11_func(int(42));
+ shared_cuda11_func(int(42));
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
return 0;
diff --git a/Tests/CudaOnly/SeparateCompilation/file1.cu b/Tests/CudaOnly/SeparateCompilation/file1.cu
index a2e8bf3..1ce63bf 100644
--- a/Tests/CudaOnly/SeparateCompilation/file1.cu
+++ b/Tests/CudaOnly/SeparateCompilation/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/CudaOnly/SeparateCompilation/file2.cu b/Tests/CudaOnly/SeparateCompilation/file2.cu
index 6b8b06b..74f3558 100644
--- a/Tests/CudaOnly/SeparateCompilation/file2.cu
+++ b/Tests/CudaOnly/SeparateCompilation/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/CudaOnly/SeparateCompilation/file3.cu b/Tests/CudaOnly/SeparateCompilation/file3.cu
index 670a18b..155b513 100644
--- a/Tests/CudaOnly/SeparateCompilation/file3.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file3.cu
@@ -6,13 +6,10 @@
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)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +17,6 @@ void file3_kernel(result_type& r, int x)
result_type file3_launch_kernel(int x)
{
result_type r;
- file3_kernel <<<1,1>>> (r,x);
+ file3_kernel<<<1, 1>>>(r, x);
return r;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu
index 86ef623..2e3e01e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file4.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file4.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file4_kernel(result_type& r, int x)
+static __global__ void file4_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file4_kernel(result_type& r, int x)
int file4_launch_kernel(int x)
{
result_type r;
- file4_kernel <<<1,1>>> (r,x);
+ file4_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu
index 6fdb32a..fee8e9e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file5.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file5.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file5_kernel(result_type& r, int x)
+static __global__ void file5_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file5_kernel(result_type& r, int x)
int file5_launch_kernel(int x)
{
result_type r;
- file5_kernel <<<1,1>>> (r,x);
+ file5_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/main.cu b/Tests/CudaOnly/SeparateCompilation/main.cu
index 5c8e150..03e0921 100644
--- a/Tests/CudaOnly/SeparateCompilation/main.cu
+++ b/Tests/CudaOnly/SeparateCompilation/main.cu
@@ -7,7 +7,7 @@
int file4_launch_kernel(int x);
int file5_launch_kernel(int x);
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
file4_launch_kernel(42);
file5_launch_kernel(42);
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
index 67bf10c..80ed3a5 100644
--- a/Tests/CudaOnly/WithDefs/main.notcu
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -6,14 +6,12 @@
#error "PACKED_DEFINE not defined!"
#endif
-static
-__global__
-void DetermineIfValidCudaDevice()
+static __global__ void DetermineIfValidCudaDevice()
{
}
#ifdef _MSC_VER
-#pragma pack(push,1)
+#pragma pack(push, 1)
#undef PACKED_DEFINE
#define PACKED_DEFINE
#endif
@@ -32,28 +30,24 @@ struct PACKED_DEFINE result_type
result_type can_launch_kernel()
{
result_type r;
- DetermineIfValidCudaDevice <<<1,1>>> ();
+ DetermineIfValidCudaDevice<<<1, 1>>>();
r.valid = (cudaSuccess == cudaGetLastError());
- if(r.valid)
- {
+ if (r.valid) {
r.value = 1;
- }
- else
- {
+ } else {
r.value = -1;
- }
+ }
return r;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
- std::cerr << cudaGetErrorString(err) << std::endl;
- return 1;
- }
+ if (err != cudaSuccess) {
+ std::cerr << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
return 0;
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b2f8ae3ba4ee6077051c97b503e1a165d4938f2
commit 0b2f8ae3ba4ee6077051c97b503e1a165d4938f2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 10:00:05 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:20:42 2017 -0500
Modules: Run clang-format on CUDA code
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
index 5aa1b8a..99bacef 100644
--- a/Modules/CMakeCUDACompilerABI.cu
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -1,5 +1,5 @@
#ifndef __CUDACC__
-# error "A C or C++ compiler has been selected for CUDA"
+#error "A C or C++ compiler has been selected for CUDA"
#endif
#include "CMakeCompilerABI.h"
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=592e3d2f96850365ee6d17989c1bca55049cfd23
commit 592e3d2f96850365ee6d17989c1bca55049cfd23
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 14 09:58:42 2017 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 14 10:20:23 2017 -0500
clang-format.bash: Format CUDA source files too
Add `.clang-format` configuration files for Cuda test directories that
use `Standard: Cpp11`. Otherwise clang-format splits the triple angle
brackets used for CUDA kernels.
diff --git a/Tests/Cuda/.clang-format b/Tests/Cuda/.clang-format
new file mode 100644
index 0000000..a77589a
--- /dev/null
+++ b/Tests/Cuda/.clang-format
@@ -0,0 +1,9 @@
+---
+# This configuration requires clang-format 3.8 or higher.
+BasedOnStyle: Mozilla
+AlignOperands: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakAfterDefinitionReturnType: None
+ColumnLimit: 79
+Standard: Cpp11
+...
diff --git a/Tests/CudaOnly/.clang-format b/Tests/CudaOnly/.clang-format
new file mode 100644
index 0000000..a77589a
--- /dev/null
+++ b/Tests/CudaOnly/.clang-format
@@ -0,0 +1,9 @@
+---
+# This configuration requires clang-format 3.8 or higher.
+BasedOnStyle: Mozilla
+AlignOperands: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakAfterDefinitionReturnType: None
+ColumnLimit: 79
+Standard: Cpp11
+...
diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash
index 8e07c99..2b36ac5 100755
--- a/Utilities/Scripts/clang-format.bash
+++ b/Utilities/Scripts/clang-format.bash
@@ -107,7 +107,7 @@ case "$mode" in
esac
# Filter sources to which our style should apply.
-$git_ls -z -- '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
+$git_ls -z -- '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' '*.cu' '*.notcu' |
# Exclude lexer/parser generator input and output.
egrep -z -v '^Source/cmCommandArgumentLexer\.' |
-----------------------------------------------------------------------
Summary of changes:
Modules/CMakeCUDACompilerABI.cu | 2 +-
.clang-format => Tests/Cuda/.clang-format | 2 +-
Tests/Cuda/Complex/dynamic.cu | 49 ++++++++++---------------
Tests/Cuda/Complex/file1.cu | 2 +-
Tests/Cuda/Complex/file2.cu | 14 +++----
Tests/Cuda/Complex/file3.cu | 30 ++++++---------
Tests/Cuda/Complex/mixed.cu | 30 ++++++---------
Tests/Cuda/ConsumeCompileFeatures/main.cu | 8 ++--
Tests/Cuda/ObjectLibrary/static.cu | 6 +--
Tests/Cuda/ProperLinkFlags/file1.cu | 2 +-
.clang-format => Tests/CudaOnly/.clang-format | 2 +-
Tests/CudaOnly/EnableStandard/main.cu | 6 +--
Tests/CudaOnly/SeparateCompilation/file1.cu | 2 +-
Tests/CudaOnly/SeparateCompilation/file2.cu | 14 +++----
Tests/CudaOnly/SeparateCompilation/file3.cu | 11 ++----
Tests/CudaOnly/SeparateCompilation/file4.cu | 10 ++---
Tests/CudaOnly/SeparateCompilation/file5.cu | 10 ++---
Tests/CudaOnly/SeparateCompilation/main.cu | 2 +-
Tests/CudaOnly/WithDefs/main.notcu | 28 ++++++--------
Utilities/Scripts/clang-format.bash | 2 +-
20 files changed, 95 insertions(+), 137 deletions(-)
copy .clang-format => Tests/Cuda/.clang-format (92%)
copy .clang-format => Tests/CudaOnly/.clang-format (92%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list