LittleFe Tutorial

These instructions should help you connect and use the LittleFe cluster computer on campus.

Connecting to LittleFe

Note: You may only be able to access LittleFe from the dorms, or from Olin. You can try other locations on campus, but I’m not sure if they will work or not.

To connect to LittleFe, we will use ssh. ssh allows you to remotely log in to a system. If you are on macOS, you should already have ssh. If you are on Windows, you may or may not have it. If you don’t, you can download a program like PuTTY.

After opening Terminal on macOS, or something like PuTTY on Windows, type ssh -o HostKeyAlgorithms=+ssh-dss yourWoffordUsername@10.76.120.20. Your username indicates that it is you logging in, and the IP address is the fixed address of LittleFe on the local Wofford network. If you are using PuTTY, you fill in the IP address ahead of time, then connect, then type your username without the IP address part.

It should ask for your password. I gave each of you a default password of 12345, so type that. Note that it will look like nothing is being typed at all, but that is correct behavior. As soon as you log in, I recommend you change your password using the passwd command. If you forget your password, just send me an email, and I can reset your password for you.

Using LittleFe

Type pwd to see the directory you are in (by default, you will be in your home directory). This is your own personal directory to use as you wish. Some other commands to try are ls to print all the files/directories in your current directory, cd to change into a new directory, cd .. to move back a directory, and mkdir to make a new directory. If you ever get lost, you can always get back to your home directory by typing cd ~.

For example, try typing the following commands (in this order, and hitting ENTER after each one):

pwd         # see your current working directory
ls          # see what is in your current working directory
mkdir test  # make a new directory inside your current working directory
cd test     # move into that new directory
pwd         # confirm that you have moved into it
ls          # see what is there (it should be nothing)
cd ..       # go back a directory
pwd         # confirm your went back
ls          # confirm your files/directories are still there

I also recommend to learn a command-line text editor like nano, vim, or emacs. nano is the easiest to get started with.

To make a new plaintext file in the current directory you are in, type nano nameOfFile.

Compiling a C Program

Create a new directory, change into it, then type nano hello.c to make a new C code file. When the editor opens, type:

#import "stdio.h"

int main() {
  printf("Hello, world!\n");
  
  return 0;
}

After you type out that program, hit CTRL+O to save it, and CTRL+X to exit nano.

To compile your program, type gcc -o hello hello.c . To run your program, type ./hello . That’s it!

Compiling and Running MPI Programs

Important Fix To Complete First!

If you are having an issue where trying to ssh into another LittleFe node always asks for your password, you will need to complete these instructions first!

  1. Change into your home directory with cd ~
  2. Type ssh-keygen, then press ENTER.
  3. Just press ENTER for each of the three prompts that come up.
  4. Move into the .ssh directory by typing cd .ssh/, then press ENTER.
  5. Copy your generated key to the authorized key file by typing cp id_rsa.pub authorized_keys, then press ENTER.
  6. That’s it! Try logging into another node to confirm it no longer asks for your password, such as ssh node011. You can then log out of that node with exit.

Compiling an MPI Program

Before you are able to run MPI programs on all of the nodes, you need to make a machine file in your home directory, so that MPI can see the other nodes. To do this, simply run bccd-snarfhosts. Give it a few seconds to finish running. After it is done, you should have a new file in your home directory called machines-openmpi. You only need to run this once ever!

Once you are ready to compile your MPI program, navigate to the directory where it is located and run the command mpicc -std=c99 -o nameOfProgram fileToCompile.c.

Running an MPI Program

After it compiles successfully, you can run your program with the command mpiexec -machinefile ~/machines-openmpi -n numberOfProcesses ./nameOfProgram

Summary

A complete run of all of these commands could look like this:

bccd-snarfhosts  # only run this command one time ever
mpicc -std=c99 -o myAwesomeProgram myAwesomeProgram.c
mpiexec -machinefile ~/machines-openmpi -n 8 ./myAwesomeProgram