diff options
Diffstat (limited to 'Tests/Cuda/ObjectLibrary/static.cu')
-rw-r--r-- | Tests/Cuda/ObjectLibrary/static.cu | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/Cuda/ObjectLibrary/static.cu b/Tests/Cuda/ObjectLibrary/static.cu new file mode 100644 index 0000000..2374c23 --- /dev/null +++ b/Tests/Cuda/ObjectLibrary/static.cu @@ -0,0 +1,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; +} |