Fix debug build.
Parallelize gradient.