Accept freevar as constants for macros
Fixes race condition when using the pagelocked staging area
Avoid synchronizing the stream by first querying to see if the event is done
Merge pull request #802 from sklam/accept_freevar

CUDA improvements and fixes