Guest User

Untitled

a guest
Dec 17th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. $ cat t1005.cu
  2. #include <iostream>
  3.  
  4. struct Thing {
  5. bool is_solid;
  6. double matrix[9];
  7. };
  8.  
  9. int main(){
  10.  
  11. Thing *things;
  12. int num_of_things = 100;
  13. cudaError_t ret = cudaMallocManaged((void **)&things, num_of_things * sizeof(Thing));
  14. if (ret != cudaSuccess) {
  15. std::cout << cudaGetErrorString(ret) << std::endl;
  16. return 1;}
  17. else {
  18. things[10].is_solid = true;
  19. std::cout << "Success!" << std::endl;
  20. return 0;}
  21. }
  22. $ nvcc -arch=sm_30 -o t1005 t1005.cu
  23. $ ./t1005
  24. Success!
  25. $
Add Comment
Please, Sign In to add comment