Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between thrust::host_vector and std::vector?

Tags:

cuda

thrust

Both allocate memory on the host and I can copy contents to device_vector and back using iterators. Why was host_vector necessary to include in the API? Does it have something to do with pinned memory?

like image 827
Souradeep Nanda Avatar asked Oct 09 '17 12:10

Souradeep Nanda


1 Answers

No, it doesn't implement pinned memory.

I suspect it exists to implement a few overrides, such as assignment from a device_vector.

Also, unlike, the std::vector implementation in MSVC, Thrust's host_vector doesn't check iterator validity which leads to much faster performance on debug builds (by default).

like image 69
Mikhail Avatar answered Nov 10 '22 00:11

Mikhail