How to make vector-type-value to pinned memory in cuda

ⅰ亾dé卋堺 提交于 2019-12-04 06:43:34

Directly, you can't allocate memory for anything other POD types using cudaMallocHost.

If you really need a std::vector which uses pinned memory, you will have to implement your own model of std::allocator which calls cudaMallocHost internally and instantiate your std::vector using that custom allocator.

Alternatively, the thrust template library (which ships in recent releases of CUDA toolkit) includes an experimental pinned memory allocator which you could use with thrusts own vector class, which is iteself a model of std::vector.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!