Make all CUDA tests pass, and add some docstrings.