Skip to content

Commit

Permalink
added pysph_viewer entry point
Browse files Browse the repository at this point in the history
fixed application interfaces for mpi runs
added pip_requirements.txt
  • Loading branch information
pankajp committed May 6, 2011
1 parent 59618d3 commit 420b4e7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include MANIFEST.in Makefile *.py *.txt
include MANIFEST.in Makefile *.py *.txt pip_requirements.txt
recursive-include examples *.py shock-tube/clawpack-solution.npz
recursive-include docs *.* *
include source/pysph/base/*.src
Expand Down
6 changes: 6 additions & 0 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
numpy
Cython
setuptools
mpi4py
numpydoc
mpi4py
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,9 @@
#setup_requires=['Cython>=0.14', 'setuptools>=0.6c1'],
#extras_require={'3D': 'Mayavi>=3.0'},
zip_safe = False,
entry_points = """
[console_scripts]
pysph_viewer = pysph.tools.mayavi_viewer:main
"""
)

49 changes: 25 additions & 24 deletions source/pysph/solver/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,32 +347,33 @@ def set_solver(self, solver):
self.command_manager = CommandManager(solver, self.comm)
solver.set_command_handler(self.command_manager.execute_commands)

# commandline interface
if self.options.cmd_line:
from pysph.solver.solver_interfaces import CommandlineInterface
self.command_manager.add_interface(CommandlineInterface().start)
if comm.Get_rank() == 0:
# commandline interface
if self.options.cmd_line:
from pysph.solver.solver_interfaces import CommandlineInterface
self.command_manager.add_interface(CommandlineInterface().start)

# XML-RPC interface
if self.options.xml_rpc:
from pysph.solver.solver_interfaces import XMLRPCInterface
addr = self.options.xml_rpc
idx = addr.find(':')
host = "0.0.0.0" if idx == -1 else addr[:idx]
port = int(addr[idx+1:])
self.command_manager.add_interface(XMLRPCInterface((host,port)).start)
# XML-RPC interface
if self.options.xml_rpc:
from pysph.solver.solver_interfaces import XMLRPCInterface
addr = self.options.xml_rpc
idx = addr.find(':')
host = "0.0.0.0" if idx == -1 else addr[:idx]
port = int(addr[idx+1:])
self.command_manager.add_interface(XMLRPCInterface((host,port)).start)

# python MultiProcessing interface
if self.options.multiproc:
from pysph.solver.solver_interfaces import MultiprocessingInterface
addr = self.options.multiproc
idx = addr.find('@')
authkey = "pysph" if idx == -1 else addr[:idx]
addr = addr[idx+1:]
idx = addr.find(':')
host = "0.0.0.0" if idx == -1 else addr[:idx]
port = int(addr[idx+1:])
self.command_manager.add_interface(MultiprocessingInterface((host,port),
authkey=authkey).start)
# python MultiProcessing interface
if self.options.multiproc:
from pysph.solver.solver_interfaces import MultiprocessingInterface
addr = self.options.multiproc
idx = addr.find('@')
authkey = "pysph" if idx == -1 else addr[:idx]
addr = addr[idx+1:]
idx = addr.find(':')
host = "0.0.0.0" if idx == -1 else addr[:idx]
port = int(addr[idx+1:])
self.command_manager.add_interface(MultiprocessingInterface(
(host,port), authkey=authkey).start)

def run(self):
"""Run the application."""
Expand Down
11 changes: 6 additions & 5 deletions source/pysph/tools/mayavi_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ def _client_changed(self, old, new):
else:
self.pa_names = self.client.controller.get_particle_array_names()

for pa in self.particle_arrays:
if pa.plot is not None:
pa.plot.remove()
self.scene.mayavi_scene.children[:] = []
self.particle_arrays = [ParticleArrayHelper(scene=self.scene, name=x) for x in
self.pa_names]
# Turn on the legend for the first particle array.
Expand Down Expand Up @@ -321,7 +319,10 @@ def error(msg):
print msg
sys.exit()

def main(args):
def main(args=None):
if args is None:
args = sys.argv[1:]

if '-h' in args or '--help' in args:
usage()
sys.exit(0)
Expand All @@ -339,5 +340,5 @@ def main(args):
m.configure_traits()

if __name__ == '__main__':
main(sys.argv[1:])
main()

0 comments on commit 420b4e7

Please sign in to comment.