Linux and stampede2 Setup -- GVA2022
- 1 Overview:
- 2 Objectives:
- 3 Example things you will encounter in the course:
- 4 Tutorial:
- 4.1.1.1 log into stampede2 with the ssh command
- 4.1.1.2 Use ls to check if particular file exists
- 4.1.1.3 Use mv to change your .profile file to a backup copy
- 4.1.1.4 Copy the course provided .profile file and change its name and permissions
- 4.1.1.5 Standard output
- 4.1.1.6 Standard output plus hidden files
- 4.1.1.7 Standard output plus hidden files in a single column
- 4.1.1.8 Standard output plus hidden files in a single column with additional information
- 4.1.1.9 Standard output plus hidden files in a single column
- 4.1.1.10 How to leave stampede2 by logout or exit from a remote connection
- 4.1.1.11 Go log back in to stampede2
- 4.1.1.12 Creating a shortcut to the main Stampede2 working directories
- 4.1.1.13 Print the contents of the .profile file to the screen
- 4.1.1.14 How to start the nano text editor
- 4.1.2 Diagram of Stampede2 directories: What connects to what, how fast, and for how long.
- 4.1.3 Understanding "jobs" and compute nodes.
- 4.2 Transferring files to and from stampede2 with scp
- 4.3 scp tutorial page.
- 4.4 Moving beyond the preinstalled commands on TACC
- 4.4.1 1. TACC modules
- 4.4.2 2. Downloading from the web directly to TACC
- 4.4.2.1 Using wget.
- 4.4.2.2 Using scp.
- 4.4.2.3 Finishing conda installation, and
- 4.4.2.4 Setting up your first environment
- 4.4.3 3. Using miniconda on TACC
- 4.4.4 Github – an additional common method of getting files onto TACC
- 4.4.5 pip
- 4.5 This concludes the the linux and stampede2 refresher/introduction tutorial.
Overview:
This portion of the class is devoted to making sure we are all starting from the same starting point on stampede. This tutorial was developed as a combined version of multiple other tutorials which were previously given credit here. Anyone wishing to use this tutorial is welcome.
This is probably the longest tutorial in the entire class. It is designed to take between 1/2 and 3/4 of the first class. Do not stress if you feel people are moving through it faster than you are, or if you do not get it done before the next presentation. There will be links back to this tutorial from other tutorials as needed, and by the 2nd half of Wednesday's class when we start with the specialized tutorials, you can circle back to this tutorial as well.
Objectives:
Familiarize yourself with the way course material will be presented.
Log into stampede2.
Change your stampede2 profile to the course specific format.
Refresh understanding of basic linux commands with some course organization.
Review use of the nano text editor program, and become familiar with several other text editor programs.
Example things you will encounter in the course:
As this is the first real tutorial you are encountering in this course, some housekeeping matters to familiarize you with how information will be presented.
Code blocks
There will be 4 types of code blocks used throughout this class. Text inside of code blocks represent at least 1 possible correct answer, and should either be typed EXACTLY into the terminal window as they are, or copy pasted. There is a notable exception that text between <> symbols represent something that you need to replace before sending it to the terminal. Yes, the <> marks themselves also need to be replaced. We try to put informative text within the brackets so you know what to replace it with. If you are ever unsure of what to replace the <> text with, just ask.
Visible
These are code blocks that you would likely have no idea what to type without help. (like when a new command is being introduced)
These will typically be associated with longer/more detailed text above the text box explaining things.
An example code block showing you the command you need to type into the prompt to list what directory you are currently in:
pwd
Hinted
These are code blocks that you can probably figure out what to type with a hint that goes beyond what the tutorial is requesting. Access the hint by clicking the triangle or hint hyperlink text.
These exist to force you to think about what command you need, and hopefully make some connections to help you remember what you will need to type in the future.
These should all come with additional explanation as to what is going on.
Rather than just expanding these by reflex, I strongly suggest seeing if you can figure out what the command will be, and checking your work
Example:
Hidden:
These code blocks represent things that you should have seen or used several times already, or things that can be succinctly explained.
Example:
use the pwd command to print your current working directory
pwd
Speed bump:
This combines the previous 2 types to deliberately slow you down and be cumbersome.
If you find yourself consistently wrong about what eventually shows up in the text box, slow down, step back, think about whats going on, and consider asking a question.
These should only come after you have seen the same (or very similar) commands in the other formats previously
Example:
Warnings
Why the tutorials have warnings?
Warnings exist for 2 reasons:
Something you are about to do can have negative impact on you
You saw an example of this talking about paying attention to warnings when using ssh to access new remote computers
Something you are about to do can have negative impacts on others
this will be related mostly to the use of "idev" sessions beginning tomorrow.
Info boxes
These are used to give more general background about things
These were introduced in the last few years, but despite requests in post-class surveys, not much feedback was provided about them. If you find them useful (or have ideas of how they might be more useful) please remember to mention them in the post class survey. At very least the hope is that they help organize information. The information in these boxes is not needed to complete the tutorials.
Tip boxes
Things I wish I knew sooner
As an example: On the command line, you can use the tab key to try to autofill the "rest" of whatever you are typing, whether it is the name of the directory, a long file, or even a command. Hitting tab twice will list all possible matches to whatever you have already typed when there are multiple different possibilities. The more you use this, the fewer typos you will have as a typo can't autofill.
Tutorial:
Logging into stampede2
Hopefully you were able to log into stampede2 last week as part of the pre-class assignment. If not make sure the instructor is aware as there are additional elements that still need to be addressed (potentially adding you to the project allocation and definitely being added to the reservation that we will use starting tomorrow).
log into stampede2 with the ssh command
ssh <username>@stampede2.tacc.utexas.eduWhen prompted enter your password, and digital security code from the app, and answer "yes" to the security question if you see one. If you previously have logged in you will not see such a question prompt.
Logging into remote computers
You are blindly told to enter yes here, only because you are given a command above to copy which will take you to a remote computer system that I know to be safe, and as this is an introductory class, it is likely you have not logged into it before. If you have previously logged into this remote computer from the local computer you are sitting at, you will not be issued a security warning prompt.
The same will be true the first time you log into any of the other TACC resource, or other remote computer. This means that it should be rare that you encounter such a prompt, and more rare still that you are surprised to find one. If you ever see a security warning logging into somewhere that you use commonly you should answer no and try to figure out why you were warned. If you are not surprised to encounter it, if you have figured out why you encountered it, or understand the risks, type "yes" to bypass the security check.
As a reminder, the ssh command, and launching programs to give you the prompt to type them was provided as part of the pre-class assignment. Convenient links incase you need them or want to refresh your memory:
Setting up your stampede2 profile
There are many flavors of Linux/Unix shells. The default for TACC's Linux (and most other Linuxes) is bash (bourne again shell), which we will use throughout. I am not aware of any others being used by biologists, so this is likely just something you will always default to.
Whenever you login via an interactive shell as you did above, a well-known script is executed by the shell to establish your favorite environment settings. I've set up a common profile for you to start with that will help you know where you are in the file system and make it easier to access some of our shared resources. If you already have a profile set up on stampede2 that you like, we want to make sure that we don't destroy it but it is critical to make sure that we change it temporarily so everyone is working from the same place through the class. Use the ls command to check if you have a profile already set up in your home directory.
Use ls to check if particular file exists
cdh
ls .profile
ls .bashrcIf you already have a .profile or .bashrc file, use the mv command to change the name to something descriptive (for example ".profile_pre_GVA_backup"). Otherwise continue to creating a new files.
Use mv to change your .profile file to a backup copy
mv .profile profile_pre_GVA_backup
mv .bashrc bashrc_pre_GVA_backupA warning about deleting files
Most of us are used to having an 'undo' button, trash/recycling collection of deleted files, or warnings when we tell a computer to do something that can't be undone. The command line offers none of these options. In extreme situations on TACC, you can use the help desk ticket system to recover a deleted file, but there is no guarantee files can be recovered under normal circumstances (we will cover exceptions to this later).
The specific warning right now is that if you have an existing profile, and have not done the above commands correctly, you will not be able to recover your existing profile. Thus this is a great opportunity to interact with your instructor and make 100% the above steps have been correctly performed. Type ls -al onto the command line and then share your screen on zoom if you are not sure
Now that we have backed up your profiles so you won't lose any previous settings, you can copy our predefined GVA2022.bashrc file from the /corral-repl/utexas/BioITeam/gva_course/ folder to your $HOME folder as .bashrc and the predefined GVA2022.profile as .profile from the same location before using the chmod command to change the permissions to read and write for the user only.
Copy the course provided .profile file and change its name and permissions
cp /corral-repl/utexas/BioITeam/gva_course/GVA2022.bashrc .bashrc
cp /corral-repl/utexas/BioITeam/gva_course/GVA2022.profile .profile
chmod 700 .bashrc
chmod 700 .profile
The chmod 700 <FILE> command marks the file as readable/writable/executable only by you. The .bashrc script file will not be executed unless it has these permissions settings.
Understanding why some files start with a "."
In the above code box, you see that the names start with a . when a filename starts with a . it conveys a special meaning to the operating system/command line. Specifically, it prevents that file from being displayed when you use the ls command unless you specifically as for hidden files to be displayed using the -a option. Such files are termed "dot-files" if you are interested in researching them further.
Let's look at a few different ways we will use the ls command throughout the course. Compare the output of the following 4 commands:
Standard output
ls #ignore everything that comes after the # mark. There is a problem on this wiki page but things after a # wont effect commands
Standard output plus hidden files
ls -a
Standard output plus hidden files in a single column
ls -a -1
Standard output plus hidden files in a single column with additional information
ls -a -lThroughout the course you will notice that many options are supplied to commands via a single dash immediately followed by a single letter. Usually when you have multiple commands supplied in this manner you can combine all the letters after a single dash to make things easier/faster to type. Experiment a little to prove to yourself that the following 2 commands give the same output.
Standard output plus hidden files in a single column
ls -a -1
ls -alWhile knowing that you can combine options in this way helps you analyze data faster/better, the real value comes from being able to decipher commands you come across on help forums, or in publications.
For ls specifically the following association table is worth making note of, but if you want the 'official' names consider using the man command to bring up the ls manual.
flag | association |
|---|---|
-a | "all" files |
-l | "long" listing of file information |
-1 | 1 column |
-h | human readable |
Getting back to your profile... Since .bashrc is executed when you login, to ensure it is set up properly you should first logout:
How to leave stampede2 by logout or exit from a remote connection
logout
# or
exitthen log back in:
Go log back in to stampede2
ssh <username>@stampede2.tacc.utexas.edu
If everything is working correctly you should now see this as your prompt:
tacc:~$It is also likely or expected that upon logging in you see the following:
The following have been reloaded with a version change:
1) impi/18.0.2 => impi/17.0.3 2) intel/18.0.2 => intel/17.0.4 3) python2/2.7.15 => python2/2.7.14These messages have to do with some of the core compilers and associated tools on TACC. You could use the module spider commands detailed below to find out more information of any of these modules and track down why such changes might be being made, but they are not concerning.
If you see anything besides "tacc:~$" as your prompt, get my attention and be ready to share your screen rather than continuing forward.
Setting up other shortcuts:
In order to make navigating to the different file systems on stampede2 a little easier ($SCRATCH and $WORK), you can set up some shortcuts with these commands that create folders that "link" to those locations. Run these commands when logged into stampede2 with a terminal, from your home directory.
Creating a shortcut to the main Stampede2 working directories
cdh
ln -s $SCRATCH scratch
ln -s $WORK work
ln -s $BI BioITeam
In previous years, several people have report seeing an error message stating "ln: failed to create symbolic link 'BioITeam/BioITeam': Permission denied." This seems to be related to different project allocations. I do not think it will be an issue for anyone this year.
Understanding what your .bashrc file actually does.
Editing files
There are a number of options for editing files at TACC. These fall into three categories:
Linux text editors installed at TACC (nano, vi, emacs). These run in your terminal window. vi and emacs are extremely powerful but also quite complex, so nano is the best choice as a first local text editor. It is also powerful enough that you can still accomplish whatever you are working on, it just might be more difficult if you try to do more complex edits. If you are already familiar with one of the other programs you are welcome to continue using it.
Text editors or IDEs that run on your local computer but have an SFTP (secure FTP) interface that lets you connect to a remote computer (Notepad++ or Komodo Edit). Once you connect to the remote host, you can navigate its directory structure and edit files. When you open a file, its contents are brought over the network into the text editor's edit window, then saved back when you save the file.
Software that will allow you to mount your home directory on TACC as if it were a normal disk e.g. MacFuse/MacFusion for Mac, or ExpanDrive for Windows or Mac ($$, but free trial). Then, you can use any text editor to open files and copy them to your computer with the usual drag-drop.
We'll go over nano together in class, but you may find these other options more useful for your day-to-day work so feel free to go over these sections in your free time to familiarize yourself with their workings to see if one is better for you.
As we will be using nano throughout the class, it is a good idea to review some of the basics. nano is a very simple editor available on most Linux systems. If you are able to use ssh, you can use nano. To invoke it, just type:
How to start the nano text editor
nano
You'll see a short menu of operations at the bottom of the terminal window. The most important are:
ctl-o - write out the file
ctl-x - exit nano
You can just type in text, and navigate around using arrow keys. A couple of other navigation shortcuts:ctl-a - go to start of line
ctl-e - go to end of line
Be careful with long lines – sometimes nano will split long lines into more than one line, which can cause problems in our commands files, and if you copy paste code into a nano editor.
What can you do to see contents of a file without opening it for editing?
Command | useful for | bad if |
|---|---|---|
head | seeing the first lines of a file (10 by default) | file is binary |
tail | seeing the last lines of a file (10 by default) | file is binary |
cat | print all lines of a file to the screen | the file is big and/or binary |
less | opens the entire file in a separate program but does not allow editing | if you are going to type a new command based on the content, or forget the q key exits the view, or file is binary |