[IPython-User] using PBS for python

Yulin Huang yulinhuang2007@gmail....
Tue Jun 25 11:33:01 CDT 2013


To whom may concern:
                My goal is to run Monte Carlo Simulations and submit to PBS
nodes as a test.

######################################
my ipython script looks like: (MC.py)
n = 1000000
def sample(n):
        return (rand(n) ** 2 + rand(n) ** 2 <= 1).sum()

from IPython.parallel import Client
#rc = Client(profile='pbs')
rc =
parallel.Client('path/.ipython/profile_pbs/security/ipcontroller-client.jason',
sshserver = '**.**.**.**')
v = rc[:]
with v.sync_imports():
        import time
#importing time onm engines(s)
        from numpy.random import rand
result = 4*sum(v.map_sync(sample,[n]*len(v)))/(n*len(v))
print result
################################################
I also have a bash script: (example.sh)
ipcluster start --profile=pbs -n 10
ipengine --profile=pbs -n 4
ipengine --ip=198.124.234.70 --port=800
python2.7 /home/yhuang/DPC/MC.py  > output.MC
ipcluster stop
#################################################
I ran the script using qsub example.sh
#################################################
My ipcontroller_config.py looks like:
# Configuration file for ipcontroller.

c = get_config()
c.HubFactory.ip = '*'
..........
##################################################
My ipcluster_config.py looks like:
c = get_config()

c.IPClusterStart.controller_launcher_class = 'PBSControllerLauncher'
c.IPClusterEngines.engine_launcher_class = 'PBSEngineSetLauncher'

c.PBSEngineSetLauncher.batch_template_file = 'pbs.engine.template'
c.PBSControllerLauncher.batch_template_file = 'pbs.controller.template'

c.PBSLauncher.queue = 'veryshort.q'
c.IPClusterEngines.n = 64
#########################################################
My ipcontroller_client.jason file looks like:
{
  "url": "tcp://*:?",
  "exec_key": "???????",
  "ssh": "",
  "location": "*.*.*.*"
}
#########################################################
When I ran the bash file,
I received the error:
NameError: name 'parallel' is not defined


Could anyone help me out?  Or point out what part I made mistakes in?
Many thanks in advance.

-- 
Best regards,


Yulin "Joyce" Huang
Ph.D in Computational Biology (SUNY-Stony Brook)
Computational Sciences Center
Brookhaven National Lab
Upton,NY,11973-5000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130625/b2749822/attachment.html 


More information about the IPython-User mailing list