Interactive Session
What does that mean? The user can submit a job to run on a compute node of the HPC, instead of submitting to the cluster (which we’ll cover in the next section). Ideal for longer-duration jobs that may require interaction somewhere in the middle.
It’s somewhat like when you go to the library and check out a book for a few hours. During that time, no one else is using that book. You can’t keep the book forever, so we’ll also teach you how to end your session so that that node is available to other users again.
This is quite easy to start:
The information given is a job number and an assigned compute node. You should see now that your prompt has changed and that you are now logged directly into a node. Even though we are logged into a node, we still have access to our directory contents.
Let’s make another directory for this section.
Just for fun, we are going to use Python while we are playing around in our session.
Python is a programming language that is popular with scientists who need to crunch data and is recommended for those who are beginners. This document is not meant to teach you how to program in Python, just that you can access your folders and use the software in an interactive session.
There is some information that pops up on the screen, namely, the Python version. Just like software, it is common for languages to go through versions. This is an older version, but there is a way to switch to a newer version. We need to exit this Python command prompt. We accomplish this by typing:
If you aren’t sure which version of Python will open when you type the python command, you can check using the which python
command. We will see we are using the older version of python (newer version has a different name).
To access a newer version we can tell the HPC where to find it and to use that version. We will access the newer version in the /share/apps
folder on the HPC (this folder contains all common programs and environments that are common to all users.
We are in the newer version of Python. Now that we have set up the appropriate version of Python, we are going to finally open Python.
We can use this to type commands just like we were doing in the shell, but instead you use the Python language. So in the shell, if we wanted to write hello world on the screen, we would have used an echo
command.
You can also perform basic math functions:
You can do lots of things from this Python command prompt, but I want to show you how to make your own Python program. Let’s write a program that counts to 100. First, let’s exit Python so we can use the shell text editor.
Note: spaces and indentations are important.
Now we can use python to run our code.
You will get an output of 0 to 99. What might be more useful is if that output ended up in a file. We can do that.
In the above command, the greater-than symbol is used to funnel the output of the program into a text file. We can use ls to check and see if the file was generated.
You should see the file numberList.txt
, and we can check the contents using the more
command.
A subset of the file will be displayed. You can use the space bar to progress through the file contents. Hooray! You wrote a program in Python.
Recall that we’ve done all of this from our interactive session. Now we are done, we need to close the connection.
This may seem trivial, but recall that your node is unavailable for use by others. What if you forget to logout? Does the world end? No, but you should clean up your interactive session. So, you forgot to close your session with the exit command, and you realized the next day that you may have left your qlogin open. First we can check that by checking the status of the queue.
You can then use the qdel
command for ending an interactive login and your job number.
Now we have ended our qlogin session. Please remember to exit your qlogin session when you are done so that those resources are available for others.
Last updated