Patched cuda code so that actual solver iterations and residual will be passed back up to python