http://code.google.com/p/pysal/source/detail?r=1185
Modified:
/branches/parallel/pysal/esda/fisherTest.py
/branches/parallel/pysal/esda/mapclassify.py
/branches/parallel/pysal/esda/mapclassify_V2.py
/branches/parallel/pysal/esda/parallell pysal.mm
=======================================
--- /branches/parallel/pysal/esda/fisherTest.py Tue Feb 21 13:01:54 2012
+++ /branches/parallel/pysal/esda/fisherTest.py Tue Feb 21 15:53:42 2012
@@ -1,27 +1,33 @@
-from mapclassify import Fisher_Jenks_1, PFisher_Jenks, PFisher_Jenks_MP
-from mapclassify import PFisher_Jenks_PP
-from mapclassify_V2 import PFisher_Jenks_PP as PFisher_Jenks_PP2
+from mapclassify_V2 import Fisher_Jenks_1, PFisher_Jenks,
PFisher_Jenks_MP, PFisher_Jenks_PP
import numpy as np
-
-if __name__ == "__main__":
- dat = np.random.rand(2000)
-
- print "Sequential\n"
- o1 = Fisher_Jenks_1(dat)
- print o1
-
- print "PyOpenCL\n"
- o2 = PFisher_Jenks(dat)
- print o2
-
- print "Multiprocessing\n"
- o3 = PFisher_Jenks_MP(dat)
- print o3
-
- print "Parallel Python\n"
- o4 = PFisher_Jenks_PP(dat)
- print o4
-
- print "Parallel Python Modified\n"
- o5 = PFisher_Jenks_PP2(dat)
- print o5
+import time
+
+np.random.seed(100)
+
+ns = [100, 500, 1000, 2000]
+ks = [4,5,6]
+
+results = {}
+for k in ks:
+ res = np.zeros((4,4))
+ for i,n in enumerate(ns):
+ print n,k
+ dat = np.random.rand(n)
+ t1 = time.time()
+ o1 = Fisher_Jenks_1(dat)
+ t2 = time.time()
+ res[0, i] = t2-t1
+ print 'FJ: ',res[0, i]
+ o2 = PFisher_Jenks(dat)
+ t3 = time.time()
+ res[1, i] = t3-t2
+ print 'FJCL: ',res[1, i]
+ o3 = PFisher_Jenks_MP(dat)
+ t4 = time.time()
+ res[2, i] = t4-t3
+ print 'FJMP: ',res[2, i]
+ o4 = PFisher_Jenks_PP(dat)
+ t5 = time.time()
+ res[3, i] = t5-t4
+ print 'FJPP: ',res[3, i]
+ results[k] = res
=======================================
--- /branches/parallel/pysal/esda/mapclassify.py Tue Feb 21 13:01:54 2012
+++ /branches/parallel/pysal/esda/mapclassify.py Tue Feb 21 15:53:42 2012
@@ -323,7 +323,7 @@
if sort:
values.sort()
- t0 = time.time()
+ #t0 = time.time()
mat1 = []
for i in range(0,len(values)+1):
temp = []
@@ -378,8 +378,8 @@
kclass[countNum - 1] = values[id]
k = int(pivot - 1)
countNum -= 1
- t1 = time.time()
- print t1 - t0
+ #t1 = time.time()
+ #print t1 - t0
return kclass
def _fisher_jenks(values, classes=5, sort=True):
@@ -460,7 +460,7 @@
if sort:
values.sort()
- t0 = time.time()
+ #t0 = time.time()
numVal = len(values)
errorMat = (numVal+1)*[0]
@@ -510,8 +510,8 @@
lastPivot = pivotMat[lastPivot][pNum]
pNum -= 1
- t1 = time.time()
- print t1 - t0
+ #t1 = time.time()
+ #print t1 - t0
return pivots
def computeError(args):
@@ -536,7 +536,7 @@
if sort:
values.sort()
- t0 = time.time()
+ #t0 = time.time()
numVal = len(values)
varMat = (numVal+1)*[0]
@@ -598,8 +598,8 @@
lastPivot = pivotMat[lastPivot][pNum]
pNum -= 1
- t1 = time.time()
- print t1 - t0
+ #t1 = time.time()
+ #print t1 - t0
return pivots
def computeErrorPP(values, pos):
@@ -627,7 +627,7 @@
if sort:
values.sort()
- t0 = time.time()
+ #t0 = time.time()
numVal = len(values)
varMat = (numVal+1)*[0]
@@ -685,8 +685,9 @@
lastPivot = pivotMat[lastPivot][pNum]
pNum -= 1
- t1 = time.time()
- print t1 - t0
+ #t1 = time.time()
+ #print t1 - t0
+ job_server.destroy()
return pivots
class Map_Classifier:
=======================================
--- /branches/parallel/pysal/esda/mapclassify_V2.py Tue Feb 21 13:01:54 2012
+++ /branches/parallel/pysal/esda/mapclassify_V2.py Tue Feb 21 15:53:42 2012
@@ -713,6 +713,7 @@
t1 = time.time()
print t1 - t0
+ job_server.destroy()
return pivots
class Map_Classifier:
=======================================
--- /branches/parallel/pysal/esda/parallell pysal.mm Mon Feb 20 10:38:14
2012
+++ /branches/parallel/pysal/esda/parallell pysal.mm Tue Feb 21 15:53:42
2012
@@ -2,7 +2,7 @@
<!-- To view this file, download free mind mapping software FreeMind from
http://freemind.sourceforge.net -->
<node CREATED="1329408682020" ID="ID_1481318209"
LINK="../../../../../../../nsf/cyber10/cyber%20infrastructure%20nsf.mm"
MODIFIED="1329413769265" TEXT="parallell pysal">
<node CREATED="1329408686020" MODIFIED="1329408690408" POSITION="left"
TEXT="plisa implementation"/>
-<node CREATED="1329408690900" MODIFIED="1329408696456" POSITION="left"
TEXT="fisher jenks optimization">
+<node CREATED="1329408690900" ID="ID_1199434912" MODIFIED="1329408696456"
POSITION="left" TEXT="fisher jenks optimization">
<node CREATED="1329409285132" MODIFIED="1329409298384" TEXT="original
implementation"/>
<node CREATED="1329409298877" MODIFIED="1329409314785" TEXT="other
implementation"/>
<node CREATED="1329409316261" MODIFIED="1329409326196" TEXT="parallel
implementations">
@@ -54,8 +54,8 @@
</node>
</node>
</node>
-<node CREATED="1329408846583" MODIFIED="1329408850017" POSITION="left"
TEXT="aag 2012">
-<node CREATED="1329408850550" MODIFIED="1329408853778" TEXT="presentation
outline">
+<node CREATED="1329408846583" ID="ID_1150394529" MODIFIED="1329408850017"
POSITION="left" TEXT="aag 2012">
+<node CREATED="1329408850550" ID="ID_881412052" MODIFIED="1329408853778"
TEXT="presentation outline">
<node CREATED="1329409094682" MODIFIED="1329409096822" TEXT="project">
<node CREATED="1329410846978" MODIFIED="1329410855839" TEXT="overview"/>
<node CREATED="1329410857082" MODIFIED="1329410860040" TEXT="asu
components"/>
@@ -112,6 +112,12 @@
<node CREATED="1329412574965" ID="ID_938617055" MODIFIED="1329412578522"
TEXT="random sampling"/>
</node>
</node>
+<node CREATED="1329827263566" ID="ID_617674810"
LINK="../../../../../../../nsf/cyber10/publications/SpringerBook-CyberGIS-WangGoodchild-cfp.pdf"
MODIFIED="1329827279110" TEXT="book chapter call">
+<node CREATED="1329827472247" ID="ID_1847540535" MODIFIED="1329827504893"
TEXT="extended abstract (1000 words) May 7, 2012"/>
+<node CREATED="1329827505401" ID="ID_683816748" MODIFIED="1329827529157"
TEXT="Acceptance Notice June 1, 2012"/>
+<node CREATED="1329827529851" ID="ID_1848942453" MODIFIED="1329827545478"
TEXT="Final Draft August 31, 2012"/>
+<node CREATED="1329827546251" ID="ID_393832269" MODIFIED="1329827558685"
TEXT="Publication January 2013"/>
+</node>
</node>
</node>
</map>