Cluster
From CSLabsWiki
| Cluster | |
| Hostname: | cluster.cslabs.clarkson.edu |
| LDAP Support: | No |
| Development Status: | Obsolete |
| Status: | Not Running |
The cluster project uses Open MPI (Message Passing Interface) which gives programmers (C, C++, Fortran 77, Fortran 90) libraries to communicate between computers. This means that the cluster will compile and run regular code, but nothing special will happen. Each computer would just run a separate copy of the program.
Contents |
How To Use
- Get a login account to cluster.cosi.clarkson.edu
- Copy your program to your account
- Compile your program
- Create a host file listing the computers you will use
- Log in as bigbrother
- Copy your program to all the computers you intend to use
- Run your program
Receiving an Account
To receive a login account to the cluster, email a member listed under Cluster on the projects page . A verification protocol will occur before any accounts are granted.
Copying the Program to the Cluster
There are many methods of copying programs to remote locations. Here is one way.
user@home:~$ scp myfile.cpp clusterusername@cluster.cosi.clarkson.edu:.
The scp command works the same way as the cp command, except it is secure and can transfer files between computers.
Compiling
Once logged in to the cluster,
Log in to cluster
user@home:~$ ssh clusterusername@cluster.cosi.clarkson.edu
all that exists is the source file. Determine the filetype: C, C++, Fortran 77, or Fortran 90. Then issue the appropriate command:
C
user@cluster:~$ mpicc myprogram.c
C++
user@cluster:~$ mpic++ myprogram.cpp
Fortran 77
user@cluster:~$ mpif77 myprogram.f
Fortran 90
user@cluster:~$ mpif90 myprogram.f
Of course, the usual parameters can be passed to create the name of the executable:
Name your executable
user@cluster:~$ mpicc myprogram.c -o myexecutable.exe
Create Host File
We are working on creating a script that will automatically check which computers are available. The host file specifies which computers the parallel program will run on. It looks something like this:
Hostfile
#hostfile.txt cluster@cosi-lab-1.sclab.clarkson.edu slots=2 cluster@cosi-lab-2.sclab.clarkson.edu slots=2
This file will tell mpirun to send the program to cosi-lab-1 and cosi-lab-2 in the lab, using the account name cluster. The slots=2 is optional, but it says that there are two processors on that machine to take advantage of.
Log In As Bigbrother
The only account that can ssh (log in remotely) to a computer in the labs is bigbrother. This means that the only way to run a parallel program (that needs to communicate between computers) is as the user bigbrother. If you have been given the password to this account, go ahead and log in now:
Log in as bigbrother with bigbrother's password
user@cluster:~$ su bigbrother
Otherwise, you should have been added as a so-called sudoer.
Log in as bigbrother with your own password
user@cluster:~$ sudo su bigbrother
Run Your Program
All that is left is to let the computers work their magic. Issue the mpirun command with the appropriate arguments and away we go!
Issue the mpirun Command
bigbrother@cluster:~$ mpirun --hostfile hostfile.txt myparallelprogram.exe
Your program will run on all the computers listed in the hostfile. Anything that happens after this depends on what you coded. Good luck!
