Files
CMake/Tests/CudaOnly/SeparateCompilationPTX/main.cu
T
Robert Maynard 61b9764b03 CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION
The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION`
now aren't mutually exclusive and can now be used together on the same
target.
2021-10-20 11:18:06 -04:00

31 lines
532 B
Plaintext

#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;
}