Implement alternative parallelization of initGradient().
cache implementation