blob: aa357295a72ae366a9245f124bf97b761285a1f3 (
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::cerr << "nDevices: " << nDevices << std::endl;
std::cerr << "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;
}
|