summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/WithDefs/main.notcu
blob: 6b02bbcc83073da1cd0c6d7b13081ca7d12ee710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>

static
__global__
void DetermineIfValidCudaDevice()
{
}

struct PACKED_DEFINE result_type
{
  bool valid;
  int value;
#if defined(NDEBUG) && !defined(DEFREL)
#error missing DEFREL flag
#endif
};

result_type can_launch_kernel()
{
  result_type r;
  DetermineIfValidCudaDevice <<<1,1>>> ();
  r.valid = (cudaSuccess == cudaGetLastError());
  if(r.valid)
    {
    r.value = 1;
    }
  else
    {
    r.value = -1;
    }
  return r;
}

int main(int argc, char **argv)
{
  cudaError_t err;
  int nDevices = 0;
  err = cudaGetDeviceCount(&nDevices);
  if(err != cudaSuccess)
    {
      return 1;
    }
  return 0;
}