summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda/Complex/dynamic.cu
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-14 15:16:32 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-14 15:21:48 (GMT)
commit33a65941fa5d7c12d79f9a4e002fed418ba6adc7 (patch)
treed3b7927977111ac2d90f233d4f8623feafefe7d9 /Tests/Cuda/Complex/dynamic.cu
parentfa5188d0edf081396ca0134d07cd8706549ddede (diff)
downloadCMake-33a65941fa5d7c12d79f9a4e002fed418ba6adc7.zip
CMake-33a65941fa5d7c12d79f9a4e002fed418ba6adc7.tar.gz
CMake-33a65941fa5d7c12d79f9a4e002fed418ba6adc7.tar.bz2
Tests: Run clang-format on CUDA code
Diffstat (limited to 'Tests/Cuda/Complex/dynamic.cu')
-rw-r--r--Tests/Cuda/Complex/dynamic.cu49
1 files changed, 19 insertions, 30 deletions
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;
- }
+ }
}