[IPython-User] using PBS for python

MinRK benjaminrk@gmail....
Tue Jun 25 16:34:16 CDT 2013


On Tue, Jun 25, 2013 at 12:33 PM, Yulin Huang <yulinhuang2007@gmail.com>wrote:

> 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
>

the NameError is right - you haven't created anything called parallel, but
you have used one.  A missing `from IPython import parallel`, or just `rc =
Client` to match your import.


>
>
> 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
>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130625/e69c30aa/attachment.html 


More information about the IPython-User mailing list