add sampling function.
add parallism level function