in progress

This commit is contained in:
Stephen Mardson McQuay 2011-03-03 00:01:46 -07:00
parent dbe981c24b
commit cbc2d13e70
3 changed files with 32 additions and 8 deletions

View File

@ -14,3 +14,8 @@ m.connect()
inq = m.get_inqueue() inq = m.get_inqueue()
outq = m.get_outqueue() outq = m.get_outqueue()
while True:
for i in xrange(1000):
X = np.random.random((1,3))[0]
utq.get()

View File

@ -6,6 +6,7 @@ from multiprocessing.managers import BaseManager
import interp.bootstrap import interp.bootstrap
from interp.grid.gmsh import gmsh_grid3D from interp.grid.gmsh import gmsh_grid3D
from interp.tools import exact
class QueueManager(BaseManager): pass class QueueManager(BaseManager): pass
QueueManager.register('get_inqueue' ) QueueManager.register('get_inqueue' )
@ -13,20 +14,18 @@ QueueManager.register('get_outqueue')
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) != 2: if len(sys.argv) != 3:
print >> sys.stderr, "usage: %s <gmsh file>" % sys.argv[0] print >> sys.stderr, "usage: %s <gmsh file> <id>" % sys.argv[0]
sys.exit(1) sys.exit(1)
m = QueueManager(address=('install', 50000), authkey='asdf') m = QueueManager(address=('gannon', 50000), authkey='asdf')
m.connect() m.connect()
inq = m.get_inqueue() inq = m.get_inqueue()
outq = m.get_outqueue() outq = m.get_outqueue()
g = gmsh_grid3D(sys.argv[1]) g = gmsh_grid3D(sys.argv[1])
my_name = sys.argv[2]
while True: while True:
id, X = inq.get() i, X = inq.get()
print id, X outq.put((i, my_name, exact(X)))
for i in xrange(10):
outq.put("hello from slave %d" % i)

20
bin/submit.py Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
from multiprocessing.managers import BaseManager
import numpy as np
import interp.bootstrap
class QueueManager(BaseManager): pass
QueueManager.register('get_inqueue' )
m = QueueManager(address=('gannon', 50000), authkey='asdf')
m.connect()
if __name__ == '__main__':
inq = m.get_inqueue()
for i in xrange(1000):
X = np.random.random((1,3))[0]
inq.put((i,X))