Coder Social home page Coder Social logo

ipython-cluster-helper's Introduction

ipython-cluster-helper

Quickly and easily parallelize Python functions using IPython on a cluster, supporting multiple schedulers. Optimizes IPython defaults to handle larger clusters and simultaneous processes.

Example

Lets say you wrote a program that takes several files in as arguments and performs some kind of long running computation on them. Your original implementation used a loop but it was way too slow

from yourmodule import long_running_function
import sys

if __name__ == "__main__":
    for f in sys.argv[1:]:
        long_running_function(f)

If you have access to one of the supported schedulers you can easily parallelize your program across 5 nodes with ipython-cluster-helper

from cluster_helper.cluster import cluster_view
from yourmodule import long_running_function
import sys

if __name__ == "__main__":
    with cluster_view(scheduler="lsf", queue="hsph", num_jobs=5) as view:
        view.map(long_running_function, sys.argv[1:])

That's it! No setup required.

To run a local cluster for testing purposes pass run_local as an extra parameter to the cluster_view function

with cluster_view(scheduler=None, queue=None, num_jobs=5,
                  extra_params={"run_local": True}) as view:
    view.map(long_running_function, sys.argv[1:])

How it works

ipython-cluster-helper creates a throwaway parallel IPython profile, launches a cluster and returns a view. On program exit it shuts the cluster down and deletes the throwaway profile.

Supported schedulers

Platform LSF ("lsf"), Sun Grid Engine ("sge"), Torque ("torque"), SLURM ("slurm").

Credits

The cool parts of this were ripped from bcbio-nextgen.

Contributors

  • Brad Chapman (@chapmanb)
  • Mario Giovacchini (@mariogiov)
  • Valentine Svensson (@vals)
  • Roman Valls (@brainstorm)
  • Rory Kirchner (@roryk)
  • Luca Beltrame (@lbeltrame)
  • James Porter (@porterjamesj)
  • Billy Ziege (@billyziege)
  • ink1 (@ink1)
  • @mjdellwo
  • @matthias-k
  • Andrew Oler (@oleraj)
  • Alain Péteut (@peteut)
  • Matt De Both (@mdeboth)
  • Vlad Saveliev (@vladsaveliev)

ipython-cluster-helper's People

Contributors

ariel215 avatar brainstorm avatar chapmanb avatar lbeltrame avatar lpantano avatar mariogiov avatar matthias-k avatar mdeboth avatar mjdellwo avatar mr-c avatar mwojcikowski avatar oleraj avatar peteut avatar roryk avatar vals avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.