You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
503 B
22 lines
503 B
|
|
#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;
|
|
}
|