Skip to content

Add support for using pinned memory for host allocations for VECCUDA

Richard Tran Mills requested to merge rmills/pinned-memory-gpu into master

This MR adds support for using pinned memory for host allocations when using VECSEQCUDA and VECMPICUDA. I started from a fork of the branch in @caidao22's !2460 (closed). Besides fixing some bugs in the original MR and working out some issues that arise when rebasing against 'master', the main things about my take on this are

  • We default to always using pinned memory for host allocations (by setting the minimum size to zero)
  • The minimum size is controlled via the options database. (I like this better than having a global setting, as it allows a bit of flexibility via options prefixes.)

I have used interactive rebase to squash many extraneous commits. I have avoided squashing everything down into one commit, as I want @caidao22's original work to show up in the history, and for it to be easy to see how (and in some cases, why) I have modified and extended that work.

Unfortunately, although I had originally hoped to do so, it is not possible to employ an approach along the lines of the one here to MATAIJCUSPARSE. There are too many complicating scenarios that can occur with matrices -- e.g., conversion of a MATAIJ to a MATAIJCUSPARSE -- that make it impossible to simply check a size threshold to know which free() implementation should be used. A more general solution along the lines of @stefanozampini's !2106 will be required. (This should perhaps all wait until we have an implementation using libaxb or similar.) However, even without having pinned memory working for matrices, having CUDA vectors using it should provide some appreciable speedup for codes utilizing large vectors.

Edited by Richard Tran Mills

Merge request reports