Skip to content

Commit

Permalink
Merge pull request #136 from university-of-york/quickUpdates
Browse files Browse the repository at this point in the history
Quick updates
  • Loading branch information
nd996 authored Dec 1, 2023
2 parents 3c84ee8 + 3b3db50 commit b691fdb
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions docs/source/using_viking/virtual_desktops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ We need more info, from the output copy and run the command from the line highli
If prompted, you should supply the following password: muAtEks5
.. tip::

You can change the size of the virtual desktop 'display' once you're logged into the virtual desktop by clicking in the top right symbols, to the right of the time and date to open a small pop up menu. Then click on the spanner button, then the control panel will appear. Click on ``Devices`` then ``Displays`` and you can adjust the setting there but not all settings will be usable. Alternatively, you can set the ``geometry`` with the ``-g`` option when you run the ``flight`` command for example: ``flight desktop start gnome -g 1600x1200``.


Create the ssh tunnel
^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -199,23 +205,54 @@ Your ``Identity`` code will be different to mine, this is just an example.
Compute node
-------------

.. attention::
The above method is great for light work like checking results but if you want to do heavier work with a graphical application then you need to use a compute node. When you've logged into the the virtual desktop :ref:`like above <virtual_desktop>`, you then request resources on a compute node using the `salloc <https://slurm.schedmd.com/salloc.html>`_ command. This takes the same options as the ``srun`` and ``sbatch`` commands so this should be familiar, here is an example:

.. code-block:: console
:caption: this describes one node, one tasks and eight CPU cores for four hours
$ salloc --nodes=1 --ntasks=1 --cpus-per-task=8 --time=04:00:00
You'll have to wait for the resources but when they are allocated you'll get output similar to that below:

.. code-block:: console
This does not currently work and it being worked on, please bear with us.
[abc123@login2[viking2] ~]$ salloc --nodes=1 --ntasks=1 --cpus-per-task=8 --time=04:00:00
salloc: Pending job allocation 689814
salloc: job 689814 queued and waiting for resources
salloc: job 689814 has been allocated resources
salloc: Granted job allocation 689814
flight start: Flight Direct environment is already active.
[abc123@login2[viking2] ~]$
The above method is great for light work like checking results but what if you want to do the heavy work with a GUI application? It's easy, when you get the the virtual desktop :ref:`like above <virtual_desktop>`, then you ask for some resources on a compute node, this is exactly the same as using the ``srun`` command however we use a special wrapper called ``start-interactive-session.sh`` in the terminal in the virtual desktop, for example:
There is one extra step, after requesting resources we need to manually ``ssh`` into the node where the resources have been allocated and ensure we use the ``-X`` option, we can easily do this using the ``$SLURM_NODELIST`` variable which Slurm sets for us:

.. code-block:: console
:caption: like ``srun``, this describes 1 node, 20 tasks, for 4 hours and runs a bash shell
$ start-interactive-session.sh -N 1 -n 20 -t 4:0:0 --pty /bin/bash
[abc123@login2[viking2] ~]$ ssh -X $SLURM_NODELIST
You'll have to wait for the resources and you'll get output similar to that below:
Very shortly you'll be logged into the compute node, with all the login welcome text and then your prompt should look something like this:

.. code-block:: console
srun: job 25363864 queued and waiting for resources
srun: job 25363864 has been allocated resources
Enabling login2 to accept our X-connection... node001 being added to access control list
[abc123@node064[viking2] ~]$
In this example I'm logged into ``node064``.


Run your program
----------------

Once you're logged into the compute node, you can now load the modules and run your graphical program. In this example we run MATLAB:

.. code-block:: console
$ module load MATLAB/2023b
$ matlab
After a few moments, the window for MATLAB should appear in your virtual desktop yet it's running on the compute node.


Tidy up
-------

After this you'll have a new session on one of the compute nodes. Stay in this terminal, load your modules and run your program and it will be running on the compute node. After you're done close everything down and remember to kill the virtual desktop just like we showed :ref:`before <kill_sessions>`.
After you're done close everything down and remember to :ref:`kill the virtual desktop <kill_sessions>` just like we showed before.

0 comments on commit b691fdb

Please sign in to comment.