static.cu 344 B

1234567891011121314151617
  1. #include <cuda.h>
  2. #include <cuda_runtime.h>
  3. #include <iostream>
  4. int __host__ cu1_sq_func(int x)
  5. {
  6. cudaError_t err;
  7. int nDevices = 0;
  8. err = cudaGetDeviceCount(&nDevices);
  9. if (err != cudaSuccess) {
  10. std::cerr << "nDevices: " << nDevices << std::endl;
  11. std::cerr << "err: " << err << std::endl;
  12. return 1;
  13. }
  14. return x * x;
  15. }