| Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
tipsntricks:ipython_notebook [2023/04/19 13:18] msovara [Security] |
tipsntricks:ipython_notebook [2024/06/21 16:01] (current) wikiadmin [Jupyter / Ipython Notebook] |
| ===== Jupyter / Ipython Notebook ===== | ===== Jupyter / Ipython Notebook ===== |
| |
| Jupyter is installed in most of the python modules. To make use of it you would do something like: | Jupyter is a commonly installed component in most Python modules, and it can be easily utilized by following a few simple steps. For instance: |
| <code bash> | <code bash> |
| jupyter-notebook | jupyter-notebook |
| </code> | </code> |
| |
| 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://wiki.chpc.ac.za/quick:start#logging_in|Logging in]] to your account check for your preferred python version as follows: | After [[http://wiki.chpc.ac.za/quick:start#logging_in|Logging in]] to your account check for your preferred python version as follows: |
| </code> | </code> |
| |
| Now proceed to request for an interactive compute node where a configuration file and security measures will be established. A single core on an interactive node has proven sufficient for this exercise, but if you are going to open multiple notebooks, request an appropriate number of cores, let's say 4, as follows: | You can now request an interactive compute node to establish a configuration file and implement security measures. For this exercise, a single core on an interactive node has been found to be sufficient. However, if you plan to open multiple notebooks, please request an appropriate number of cores, such as four, using the following command: |
| |
| <code bash> | <code bash> |
| qsub -I -P PROJ0101 -q serial -l select=1:ncpus=4:mpiprocs=4:nodetype=haswell_reg | qsub -I -P PROJ0101 -q serial -l select=1:ncpus=4:mpiprocs=4 |
| </code> | </code> |
| |
| //**Note**:// | //**Note**:// |
| -//"PROJ0101" is an arbitrary project name, kindly use your research project's shortname e.g. //ERTH0859\\ | -// Kindly replace "PROJ0101" with your research programme's short name e.g. //ERTH0859\\ |
| -// Record the cnode ID because you will ssh into that particular compute node when setting up your password.// | -// Make sure to record the cnode ID as you will need to ssh into that specific compute node when setting up your password..// |
| -//Advanced interactive compute node settings are found here: [[http://wiki.chpc.ac.za/howto:tipsandtricks#using_an_interactive_pbs_session | Example interactive job request]].// | -//Advanced interactive compute node settings are found here: [[http://wiki.chpc.ac.za/howto:tipsandtricks#using_an_interactive_pbs_session | Example interactive job request]].// |
| |
| |
| <code bash> | <code bash> |
| qsub -I -P PROJ0101 -q bigmem -l select=1:ncpus=4:mpiprocs=4:nodetype=haswell_fat | qsub -I -P PROJ0101 -q bigmem -l select=1:ncpus=4:mpiprocs=4 |
| </code> | </code> |
| |
| **Note** | **Note** |
| -//This writes a default config file to: /home/USERNAME/.jupyter/jupyter_notebook_config.py//, where USERNAME is YOUR username. | -//This writes a default config file to: /home/USERNAME/.jupyter/jupyter_notebook_config.py//, where USERNAME is YOUR username. |
| -//The output file "jupyter_notebook_config.py" will be listed as a hidden file. Thus, to list it do a $ ls -a // | -//The output file "jupyter_notebook_config.py" will be listed as a hidden file. To display it, execute the command $ ls -a. // |
| |
| 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): |
| </code> | </code> |
| |
| If your desktop system runs Windows, a simple way to deal with this is to run a unix-like environment inside Windows. You can either use[[http://cygwin.com|Cygwin]] Cygwin directly, or start a "Local Terminal" in [[https://mobaxterm.mobatek.net/|MobaXterm]]. From this terminal you can edit the local ''~/.ssh/config'' file as if you were working on a Linux computer. | If your desktop system runs Windows, a simple way to deal with this is to run a unix-like environment inside Windows. You can either use[[http://cygwin.com|Cygwin]] Cygwin directly, or start a "Local Terminal" in [[https://mobaxterm.mobatek.net/|MobaXterm]]. From this terminal you can edit the local ''.ssh/config'' file as if you were working on a Linux computer. |
| |
| | |
| Continue to edit the ''~/.ssh/config'' file on your local machine by adding in these lines: | Find, |
| | <code> |
| | ls -al |
| | </code> |
| | ... and continue to edit the ''.ssh/config'' file on your local machine by adding in these lines: |
| <code> | <code> |
| Host cnode* | Host cnode* |
| </code> | </code> |
| |
| You should be prompted for your password, twice. This is because the ''ssh'' logs in to Lengau first and then from Lengau it logs into the the compute node. On the first login, MobaXterm will offer to remember your password, and if you allow it to do so it will not be necessary to re-enter it. | You should be prompted for your CLUSTER password, twice. This is because the ''ssh'' logs in to Lengau first and then from Lengau it logs into the the compute node. On the first login, MobaXterm will offer to remember your password, and if you allow it to do so it will not be necessary to re-enter it. |
| |
| You are now ready to roll... | You are now ready to roll... |