I use Unix command time to analyze the execution time.


Macbook Pro:
real    0m19.165s
user    2m14.593s
sys    0m1.469s


Ubuntu:
real    2m29.506s
user    7m28.857s
sys    11m54.686s


It seems to take much time in sys. on Ubuntu. I finally add os.environ["OMP_NUM_THREADS"] = "1" to solve this issue, which was found at this issue: What is the purpose of `os.environ[‘OMP_NUM_THREADS’] = ‘1’  22
After I set OMP_NUM_THREADS to 1, the execution time of Ubuntu 16.04 LTS is:




real
0m11.914s




user
1m21.437s


sys
0m0.654s