Ask Your Question
1

cuda::Stream in v3 (CudaMem, Stream::enqueUpload())

asked 2016-02-15 14:19:54 -0600

Leonid Volnitsky gravatar image

updated 2016-02-15 15:17:48 -0600

I am trying to rewrite some CPU algorithm in OpenCV-3.1 Cuda with streams. I've figured out that API changed. I've looked at the docs, samples directory and I've googled for it. No answer.

It seams that type CudaMem was changed to HostMem. When I am trying to use stream upload, I am getting:

error: ‘class cv::cuda::Stream’ has no member named ‘enqueueUpload’

How to use streams with page locked memory in OpenCV-3.1?

edit retag flag offensive close merge delete

Comments

How are you using the stream? Could you provide some relevant part of your code?

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2016-02-16 02:51:26 -0600 )edit

I was trying to use code from http://stackoverflow.com/questions/17...

Leonid Volnitsky gravatar imageLeonid Volnitsky ( 2016-02-16 04:13:49 -0600 )edit

I'm also interested in this. It seems that the cv::cuda::CudaMem class has been removed, and instead there is the cv::cuda::HostMem class now.

wronglyNeo gravatar imagewronglyNeo ( 2016-03-19 11:46:41 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-03-21 05:21:09 -0600

wronglyNeo gravatar image

updated 2016-03-21 05:21:50 -0600

I think the way to go now works the following way:

//allocate page locked memory
cv::cuda::HostMem memory(rows, cols, type, cv::cuda::HostMem::PAGE_LOCKED);
//now copy something to the memory or fill it with sth. For example:
cv::Mat image = cv::imread(...);
image.copyTo(memory);

//now upload to gpu mat
cv::cuda::GpuMat gpuImage;
cv::cuda::Stream stream;
//this should replace Stream::enqueueUpload
gpuImage.upload(memory, stream);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-02-15 14:19:54 -0600

Seen: 1,402 times

Last updated: Mar 21 '16