Exemplo n.º 1
0
    def testPickledSharing(self):

        ss = [(x, x + 10) for x in range(0, 120, 20)]
        s = SegmentList(iter=ss, normalize=True)
        s.share("/testshare")
        b = pickle.loads(pickle.dumps(s))
        self.assertEqual(s, b)
Exemplo n.º 2
0
    def testSharing(self):

        ss = [(x, x + 10) for x in range(0, 120, 20)]
        s = SegmentList(iter=ss, normalize=True)
        s.share("/testshare")
        n = SegmentList(share=s)
        self.assertEqual(s, n)
Exemplo n.º 3
0
    def testUnsharing(self):

        ss = [(x, x + 10) for x in range(0, 120, 20)]
        s = SegmentList(iter=ss, normalize=True)
        s.share("/testshare")
        s.unshare()
        s.share("/testshare")
        s.unshare()
Exemplo n.º 4
0
import multiprocessing
from gat.SegmentList import SegmentList

nsegments = 100000000
nsegments = 10000000
ncpu = 2
nwork = 100

s = SegmentList(iter=[(x, x + 1) for x in range(0, nsegments, 2)],
                normalize=True)

print("built list")
r = input("press return")

s.share("/test")

print("shared data")
r = input("press return")


def dowork(segs):
    while 1:
        pass
    return segs.sum()


p = multiprocessing.Pool(ncpu)

print("starting mp")
r = p.map(dowork, [s for i in range(nwork)])