This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tipsntricks:ipython_notebook [2021/03/11 14:52] ccrosby [Security] |
tipsntricks:ipython_notebook [2024/06/21 16:01] (current) wikiadmin [Jupyter / Ipython Notebook] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Jupyter / Ipython Notebook ===== | ===== Jupyter / Ipython Notebook ===== | ||
| - | Jupyter is installed in most of the python | + | Jupyter is a commonly |
| <code bash> | <code bash> | ||
| jupyter-notebook | jupyter-notebook | ||
| </ | </ | ||
| - | However using it effectively on the cluster is a bit more complicated... | + | However, using it effectively on the cluster is a bit more complicated... |
| After [[http:// | After [[http:// | ||
| Line 14: | Line 14: | ||
| </ | </ | ||
| - | Now proceed to request | + | You can now request an interactive compute node to establish |
| <code bash> | <code bash> | ||
| - | qsub -I -P PROJ0101 -q serial -l select=1: | + | qsub -I -P PROJ0101 -q serial -l select=1: |
| </ | </ | ||
| // | // | ||
| - | -//" | + | -// Kindly replace |
| - | -// Record | + | -// Make sure to record |
| -//Advanced interactive compute node settings are found here: [[http:// | -//Advanced interactive compute node settings are found here: [[http:// | ||
| Line 28: | Line 28: | ||
| <code bash> | <code bash> | ||
| - | qsub -I -P PROJ0101 -q bigmem -l select=1: | + | qsub -I -P PROJ0101 -q bigmem -l select=1: |
| </ | </ | ||
| Line 48: | Line 48: | ||
| **Note** | **Note** | ||
| -//This writes a default config file to: / | -//This writes a default config file to: / | ||
| - | -//The output file " | + | -//The output file " |
| Next you need to generate your password (remember it -- you'll need it when you connect later): | Next you need to generate your password (remember it -- you'll need it when you connect later): | ||
| Line 64: | Line 64: | ||
| Your password hash will be different. | Your password hash will be different. | ||
| - | Use the following command to access the " | ||
| - | Now edit the file '' | ||
| + | Exit python and then use the following command to access the " | ||
| + | <code bash> | ||
| + | cd .jupyter/ | ||
| + | </ | ||
| + | Now edit the file '' | ||
| < | < | ||
| + | vim jupyter_notebook_config.py | ||
| c.NotebookApp.password = ' | c.NotebookApp.password = ' | ||
| </ | </ | ||
| Line 80: | Line 84: | ||
| **VERY IMPORTANT: | **VERY IMPORTANT: | ||
| - | Open a terminal on your local machine | + | Open a terminal on your **local** workstation |
| < | < | ||
| Line 86: | Line 90: | ||
| </ | </ | ||
| - | If your desktop system runs Windows, a simple way to deal with this is to run a unix-like environment inside Windows. | + | If your desktop system runs Windows, a simple way to deal with this is to run a unix-like environment inside Windows. |
| - | Continue | + | Find, |
| + | < | ||
| + | ls -al | ||
| + | </ | ||
| + | ... and continue | ||
| < | < | ||
| Host cnode* | Host cnode* | ||
| Line 95: | Line 103: | ||
| User YOURUSERNAME | User YOURUSERNAME | ||
| ProxyCommand ssh YOURUSERNAME@lengau.chpc.ac.za nc %h 22 | ProxyCommand ssh YOURUSERNAME@lengau.chpc.ac.za nc %h 22 | ||
| - | LocalForward | + | LocalForward |
| + | Host fat* | ||
| + | Hostname %h | ||
| + | User YOURUSERNAME | ||
| + | ProxyCommand ssh YOURUSERNAME@lengau.chpc.ac.za nc %h 22 | ||
| + | LocalForward 8888 localhost: | ||
| </ | </ | ||
| + | |||
| + | |||
| + | Remember to replace " | ||
| At this point you may not know what the LocalForward and localhost port numbers are so, on the cluster in the interactive node you had opened earlier type: | At this point you may not know what the LocalForward and localhost port numbers are so, on the cluster in the interactive node you had opened earlier type: | ||
| Line 102: | Line 118: | ||
| jupyter-notebook --no-browser | jupyter-notebook --no-browser | ||
| </ | </ | ||
| - | Edit given port number into LocalForward and localhost above | + | Edit the given port number into LocalForward and localhost above |
| **Note** | **Note** | ||
| Line 108: | Line 124: | ||
| -//Confirm the localForward and localhost port numbers provided for each different session.// | -//Confirm the localForward and localhost port numbers provided for each different session.// | ||
| - | In your local terminal '' | + | In your local terminal '' |
| < | < | ||
| - | ssh cnode* | + | ssh cnode1234 |
| </ | </ | ||
| - | You should be prompted for your password, twice. This is because the '' | + | You should be prompted for your CLUSTER |
| You are now ready to roll... | You are now ready to roll... | ||
| - | In your browser go to: http:// | + | In your browser go to: http:// |
| The jobscript will look something like: | The jobscript will look something like: | ||
| <file bash jupyter.qsub> | <file bash jupyter.qsub> | ||
| #!/bin/bash | #!/bin/bash | ||
| - | #PBS -P SHORTNAME | + | #PBS -P ERTH1234 |
| #PBS -q serial | #PBS -q serial | ||
| - | #PBS -l select=1: | + | #PBS -l select=1: |
| #PBS -l walltime=08: | #PBS -l walltime=08: | ||
| #PBS -N Jupyter | #PBS -N Jupyter | ||
| Line 133: | Line 149: | ||
| module add chpc/ | module add chpc/ | ||
| - | JUPYTERPORT=8838 # you could change this too, if you wanted to. | + | JUPYTERPORT=8888 # you could change this too, if you wanted to. |
| hostname > ~/ | hostname > ~/ | ||
| Line 145: | Line 161: | ||
| </ | </ | ||
| - | Then, again on your local machine, you need to connect to the compute node, i.e. '' | + | Then, again on your local machine, you need to connect to the allocated |
| ==== Running Jupyter on a GPU node ==== | ==== Running Jupyter on a GPU node ==== | ||