Advertisement
gaurish108

Memory allocation error while using Thrust

Jan 4th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <thrust/host_vector.h>
  2. #include <thrust/device_vector.h>
  3. #include <cuda.h>
  4. #include <iostream>
  5.  
  6. int main(void)
  7. {
  8.   size_t free, total;
  9.  
  10.   cudaMemGetInfo (&free , &total);
  11.   std::cout << "Free Memory                                    : " << free  << std::endl ;
  12.   std::cout << "Total amount of memory                         : " << total <<std::endl;
  13.  
  14.     //Use Thrust to  initialize all ten integers of a device_vector to 1
  15.     thrust::device_vector<int> D(10, 1);
  16.     //Print out the device vector.
  17.     for (int i = 0; i < D.size(); ++i)
  18.      {
  19.       std::cout << D[i] <<std::endl ;
  20.      }
  21.    
  22.  
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement