浅尝辄止 Parallel Python

Parallel Python是Python进行分布式计算的开源模块，能够将计算压力分布到多核CPU或集群的多台计算机上，能够非常方便的在内网中搭建一个自组织的分布式计算平台。先从多核计算开始，普通的Python应用程序只能够使用一个CPU进程，而通过Parallel Python能够很方便的将计算扩展到多个CPU进程中，使用官方网站上的一个例子。

Sum of primes below 100000 is 454396537
Sum of primes below 100100 is 454996777
Sum of primes below 100200 is 455898156
Sum of primes below 100300 is 456700218
Sum of primes below 100400 is 457603451
Sum of primes below 100500 is 458407033
Sum of primes below 100600 is 459412387
Sum of primes below 100700 is 460217613
Time elapsed: 4.46900010109 s

Starting pp with 2 workers
Sum of primes below 100 is 1060
Sum of primes below 100000 is 454396537
Sum of primes below 100100 is 454996777
Sum of primes below 100200 is 455898156
Sum of primes below 100300 is 456700218
Sum of primes below 100400 is 457603451
Sum of primes below 100500 is 458407033
Sum of primes below 100600 is 459412387
Sum of primes below 100700 is 460217613
Time elapsed: 2.26600003242 s
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
9 | 100.00 | 3.9700 | 0.441111 | local

1.如果数据交换存在瓶颈，大数据量的应用效果不明显，或反而效率更低。

2.高计算复杂度的应用效果不明显，ArcGIS Python中的分析计算恰好属于此类。

[En]

Of course, the test script is mainly aimed at the operation of copying spatial data, and you can try spatial analysis if you don’t give up. Let’s go deeper and continue.

Original: https://www.cnblogs.com/flyingis/archive/2009/11/12/1601574.html
Author: Flyingis
Title: 浅尝辄止 Parallel Python

(0)