summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda/Complex/dynamic.cu
blob: fc22c8b0f084f208ac96a21e6776749fe58355e7 (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

#include <string>
#include <cuda.h>
#include <iostream>

#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif

int dynamic_base_func(int);

EXPORT int __host__ cuda_dynamic_host_func(int x)
{
  return dynamic_base_func(x);
}

static
__global__
void DetermineIfValidCudaDevice()
{
}

EXPORT void cuda_dynamic_lib_func()
{
  DetermineIfValidCudaDevice <<<1,1>>> ();
  cudaError_t err = cudaGetLastError();
  if(err != cudaSuccess)
    {
    std::cerr << "DetermineIfValidCudaDevice [SYNC] failed: "
              << cudaGetErrorString(err) << std::endl;
    }
}