Added cuda runtime error check.