Skynet.coe

From Tutorials

Jump to: navigation, search

This is a short tutorial on how to use the cluster in a basic way using openmpi and C. More detailed instructions can branch off this page.

This tutorial will show you how to:


Contents

login

First, you must obviously create an account. Go to coe.isu.edu/cs for more information. Access to skynet is mostly via ssh. See Remote Login.

View Complete Documentation

The complete documentation can be found either at skynet.coe.isu.edu or at rocksclusters.org.

Monitor Cluster Status

The cluster status can be monitored using ganglia (the web) or by using qstat.

Ganglia is restricted since it gives away so much information about our cluster. If you submit me an IP address, I will probably let it through the firewall. By default, IPs from the college of engineering are let through. Alternatively, you can ssh into progeny or skynet and forward X and start firefox, or use a text based browser like links.

qstat part of the sun grid engine package gets all the same information as ganglia. Type man qstat for more information.

compile an MPI program

To compile an mpi program, you use mpixx, where xx is usually cc, c++, f77, or f90 depending on the language your program was written in. In the simplest case, take the following hello world C program.

/* /home/myuser/hello.c */
#include <stdio.h>  
#include <stdlib.h> 
#include <mpi.h>    /* all MPI-2 functions defined here */
int main(argc, argv)
int argc;
char *argv[];
{
  int rank, size, length;
  char name[BUFSIZ];
  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Get_processor_name(name, &length);
  printf("%s: hello world from process %d of %d\n", name, rank, size);
  int i;
  for(i = 0; i<10; i++)
  {
    printf("%s: %i\n",name,i);
  }
  MPI_Finalize();
  exit(0);
}
   

Note: I wrote this using vim logged into an ssh session, which is pretty standard.

this is standard mpi and can be compiled with mpicc. However, you have a choice to use the openmpi, mpich, or lam implementation. Remember which path you choose and stick to it. Here, I use openmpi.

To compile

 /opt/openmpi/bin/mpicc hello3.c

This will produce an executable, a.out

Run an MPI Program

Create a file called machines that contains the nodes you want to make use of.

compute-0-0
compute-0-1
compute-0-2
compute-0-3

These are machines on the network, and there names can be found on skynet.coe.isu.edu or in the /etc/hosts file.

To execute this, you use mpirun. Note must use the same library you chose before, in my case openmpi.

To run

 /opt/openmpi/bin/mpirun -np 4 -machinefile ./machines /home/myuser/a.out

It's probably a good idea to use complete paths here, so the machines know where to look for things. The machines file doesn't matter because it is only used by the frontend to determine which nodes to use.

This produces the following output

compute-0-0.local: hello world from process 0 of 4
compute-0-3.local: hello world from process 3 of 4
compute-0-2.local: hello world from process 2 of 4
compute-0-1.local: hello world from process 1 of 4
compute-0-0.local: 0
compute-0-2.local: 0
compute-0-1.local: 0
compute-0-0.local: 1
compute-0-3.local: 0
compute-0-3.local: 1
compute-0-3.local: 2
compute-0-3.local: 3
compute-0-3.local: 4
compute-0-3.local: 5
compute-0-3.local: 6
compute-0-3.local: 7
compute-0-3.local: 8
compute-0-3.local: 9
compute-0-2.local: 1
compute-0-1.local: 1
compute-0-0.local: 2
compute-0-2.local: 2
compute-0-1.local: 2
compute-0-0.local: 3
compute-0-2.local: 3
compute-0-1.local: 3
compute-0-0.local: 4
compute-0-2.local: 4
compute-0-1.local: 4
compute-0-0.local: 5
compute-0-2.local: 5
compute-0-1.local: 5
compute-0-0.local: 6
compute-0-2.local: 6
compute-0-1.local: 6
compute-0-0.local: 7
compute-0-2.local: 7
compute-0-1.local: 7
compute-0-0.local: 8
compute-0-2.local: 8
compute-0-1.local: 8
compute-0-0.local: 9
compute-0-2.local: 9
compute-0-1.local: 9

submit a job using qsub

Generally, you want to submit any real cluster use using a scheduler. The scheduler on skynet is sge (sun grid engine). Google this for complete information.

Basically, a rule of thumb is if your job will take > 1 minute to complete, use the scheduler.

In the simplest case, you can create a stupid bash script that runs your program.

#!/bin/bash
#stupid.sh
/home/myuser/a.out

Now to submit this job, you use qsub with various options including -pe programlib <numprocessors>

To monitor submissions use qstat or ganglia (see above)

To delete submissions use qdel.

Personal tools