title: simple sorting using thrust not working
body: <p>I have a cuda  thrust program as</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include&lt;iostream&gt;
  #include &lt;cuda.h&gt;
  #include &lt;thrust/sort.h&gt;
  
  
  
  // main routine that executes on the host
  int main(void)
  {
    int *a_h, *a_d;  // Pointer to host &amp; device arrays
    const int N = 10;  // Number of elements in arrays
    size_t size = N * sizeof(int);
    a_h = (int *)malloc(size);        // Allocate array on host
    cudaMalloc((void **) &amp;a_d, size);// Allocate array on device
    std::cout&lt;&lt;"enter the 10 numbers";
    // Initialize host array and copy it to CUDA device
    for (int i=0; i&lt;N; i++) 
    {
        std::cin&gt;&gt;a_h[i];
    }
    for (int i=0; i&lt;N; i++) printf("%d %d\n", i, a_h[i]);
    cudaMemcpy(a_d, a_h, size, cudaMemcpyHostToDevice);
    thrust::sort(a_d, a_d + N);
    // Do calculation on device:
  
    cudaMemcpy(a_h, a_d, sizeof(int)*N, cudaMemcpyDeviceToHost);
    // Print results
    for (int i=0; i&lt;N; i++) printf("%d %d\n", i, a_h[i]);
    // Cleanup
    free(a_h); cudaFree(a_d);
  } 
  </code></pre>
  
  <p>but it is not running to give the desired output.</p>
  
  <p>Are we supposed to use the host vector and device vector for sorting in thrust???? </p>