Contrib rgputools n cuda

This includes also a tiny CUDA patch relevant to #252