summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/SeparateCompilationPTX/main.cu
blob: 164cde55a7016199c5a0dcff2c55c5727e520d92 (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
#include <iostream>

#include <cuda.h>

#include "embedded_objs.h"

int main()
{
  cuInit(0);
  int count = 0;
  cuDeviceGetCount(&count);
  if (count == 0) {
    std::cerr << "No CUDA devices found\n";
    return 1;
  }

  CUdevice device;
  cuDeviceGet(&device, 0);

  CUcontext context;
  cuCtxCreate(&context, 0, device);

  CUmodule module;
  cuModuleLoadData(&module, kernels);
  if (module == nullptr) {
    std::cerr << "Failed to load the embedded ptx" << std::endl;
    return 1;
  }
  std::cout << module << std::endl;
}