improved parallel version for computeHKParam