smbinterp/bin/slave.py

37 lines
852 B
Python
Raw Normal View History

2011-03-02 22:51:43 -08:00
#!/usr/bin/env python
import sys
from multiprocessing.managers import BaseManager
2011-03-02 23:20:03 -08:00
import numpy as np
2011-03-02 22:51:43 -08:00
import interp.bootstrap
from interp.grid.gmsh import gmsh_grid3D
2011-03-02 23:01:46 -08:00
from interp.tools import exact
2011-03-02 22:51:43 -08:00
class QueueManager(BaseManager): pass
QueueManager.register('get_inqueue' )
QueueManager.register('get_outqueue')
if __name__ == '__main__':
2011-03-02 23:01:46 -08:00
if len(sys.argv) != 3:
print >> sys.stderr, "usage: %s <gmsh file> <id>" % sys.argv[0]
2011-03-02 22:51:43 -08:00
sys.exit(1)
2011-03-02 23:01:46 -08:00
m = QueueManager(address=('gannon', 50000), authkey='asdf')
2011-03-02 22:51:43 -08:00
m.connect()
inq = m.get_inqueue()
outq = m.get_outqueue()
g = gmsh_grid3D(sys.argv[1])
2011-03-02 23:20:03 -08:00
g.q = np.array([exact(x) for x in g.verts])
2011-03-02 23:01:46 -08:00
my_name = sys.argv[2]
2011-03-02 22:51:43 -08:00
while True:
2011-03-02 23:01:46 -08:00
i, X = inq.get()
2011-03-02 23:20:03 -08:00
a = g.run_baker(X, order = 3, extra_points = 32)
outq.put((i, my_name, a['qlin'], a['error'], a['final'], exact(X)))