cuda: pin input buffer before doing a memcpy to device memory.

This seems to increase performance somewhat.
cuda: pin output buffers before transferring the data back to host memory.

This increases performance somewhat.