Giter VIP home page Giter VIP logo

ipynbhpc's Introduction

ipynbhpc: IPython notebook launcher for HPC systems

Launch an interactive job via PBS (or equivalent) from a login node, start IPython notebook on a computing node, and create an SSH tunnel from the computing node to the login node. Then that port can be SSH tunneled again to a Linux/MAC/Windows machine and the IPython notebook opened locally in the browser.

Therefore the IPython notebook frontend runs in the browser on your local machine, while the IPython kernel runs on the computing node of the cluster, results, as well as plots are tunneled via SSH from the computing node to the local machine, where they are displayed and can be saved as .png just right-clicking on them.

Local machine setup

  • Choose a port number [>1024]

  • Create a bash alias (or a Putty profile) to connect to the HPC cluster tunneling that port

      alias sshcluster="ssh yourclusterhostname -L PORT:localhost:PORT"
    

Cluster setup

You need to be able to SSH passwordless locally:

ssh localhost

should work without the need to type the password.

If you already have a private key in .ssh/id_rsa you can use it, otherwise create a new key with:

ssh-keygen

then you can just add the related public key .ssh/id_rsa.pub to .ssh/authorized_keys (the same works with a DSA key).

Script setup (on the cluster)

Clone the repository and symlink the script to a folder in your PATH, i.e. ~/bin/.

Customize the script options with environmental variables, add the export commands to your .bashrc or .profile so they are set automatically at each login.

Set the port defined in Local machine setup

export IPYNB_PORT=XXXX

Set the PBS job duration in minutes:

export IPYNB_MINUTES=30

Set the template for requesting an interactive job, it should accept the number of minutes as %d, this example is the default and works on SDSC Gordon:

export IPYNB_QSUB_TEMPLATE="qsub -I -V -l nodes=1:ppn=16:native:flash,walltime=%d:00 -q normal" 

For example on NERSC Carver it would be:

export IPYNB_QSUB_TEMPLATE="qsub -I -V -l nodes=1:ppn=1,pvmem=20gb -l walltime=%d:00"

Set the template for launching the IPython notebook, generally there should be no need to set this variable, the default should be enough:

export IPYNB_NOTEBOOK_TEMPLATE="ipython notebook --pylab=inline --port=%s --no-browser"

Use the script

  • SSH in the cluster login node using the bash alias

  • Open screen to prevent a disconnection to kill your job (if available, on Gordon it is not)

  • Launch the script with:

      ipynbhpc
    
  • Wait for the terminal to return:

      Succesfully opened notebook!
    
  • Connect with the browser on your local machine to localhost:PORT, where PORT is the port you chose.

  • To kill the process and release the node before completion of the job, just use CTRL+C on the terminal

Feedback

This has been tested only on SDSC Gordon and NERSC Carver, if you find any problem or have a feature request, please open an issue on Github:

https://github.com/pyHPC/ipynbhpc/issues

Authors

ipynbhpc's People

Contributors

zonca avatar

Watchers

Kathy Traxler 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.