Fixed CPU implementation and added OPENMP