Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

thrust::copy between host & device is not interoperable with thrust::cuda::par.on(stream) #651

Closed
jaredhoberock opened this issue Mar 25, 2015 · 1 comment · Fixed by #652
Labels
type: enhancement New feature or request.

Comments

@jaredhoberock
Copy link
Contributor

The program crashes:

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/execution_policy.h>

int main()
{           
  int N = 5000;

  cudaStream_t stream;
  cudaStreamCreate(&stream);
  thrust::host_vector<float> filterVecHost(N);      
  thrust::device_vector<float> filterVecGpu(N);     
  thrust::copy(thrust::cuda::par.on(stream), filterVecHost.begin(), filterVecHost.end(), filterVecGpu.begin()); 


  return 0;
}

Originally reported here: https://groups.google.com/d/msg/thrust-users/5q9YBPjjMrI/R5NCrB2wH6EJ

@jaredhoberock jaredhoberock added the type: enhancement New feature or request. label Mar 25, 2015
@jaredhoberock jaredhoberock added this to the Release1.9 milestone Mar 25, 2015
@jaredhoberock
Copy link
Contributor Author

It might be possible to avoid this problem if we forego the execution policy-based dispatching trivial_copy_n and the like use and use cudaMemcpyDefault instead.

jaredhoberock added a commit that referenced this issue Mar 25, 2015
Because the user may have explicitly passed an execution policy such as thrust::cuda::par.on(stream), trivial_copy_n could be cross-space. Dynamically infer the directionality of the copy using cudaMemcpyDefault.

Fixes #651
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement New feature or request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant