Figured out the previous problem is MPI related, probably caused by int overflow, now use MPI_DOUBLE intead of MPI_BYTE so num is reduced to 1/8 or original