restructure cmp_all so that it's omp compatible