blob: 2374c23627c057b91bece49020f9e50dee8743b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
int __host__ file1_sq_func(int x)
{
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
if(err != cudaSuccess)
{
std::cout << "nDevices: " << nDevices << std::endl;
std::cout << "err: " << err << std::endl;
return 1;
}
std::cout << "this library uses cuda code" << std::endl;
std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;
return x * x;
}
|